Skip to content

Add PHP support#141

Merged
marcospassos merged 4 commits into
masterfrom
php-support
Jun 17, 2026
Merged

Add PHP support#141
marcospassos merged 4 commits into
masterfrom
php-support

Conversation

@marcospassos

Copy link
Copy Markdown
Member

Summary

Add support for PHP SDKs.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@marcospassos marcospassos added the feature New feature label Jun 16, 2026
@github-actions

Copy link
Copy Markdown

👋 @marcospassos
Thanks for your contribution!
The approval and merge process is almost fully automated 🧙
Here's how it works:

  1. You open a new pull request
  2. Automated tests check the code
  3. Maintainers review the code
  4. Once approved, the PR is ready to merge.

👉 Omit the extended description
Please remove the commit body before merging the pull request.
Instead, include the pull request number in the title to provide the full context
about the change.

☝️ Lastly, the title for the commit will come from the pull request title. So please provide a descriptive title that summarizes the changes in 50 characters or less using the imperative mood.
Happy coding! 🎉

@pkg-pr-new

pkg-pr-new Bot commented Jun 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/croct@141

commit: 0f55057

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class PHP SDK support to the CLI, including Composer-based dependency management, PHP/Laravel/Symfony/Drupal project detection and setup flows, PHP example generation/presentation, and supporting codemods/formatting.

Changes:

  • Introduce a Composer package manager/agent, PHP formatter, and PHP SDK base + framework-specific SDKs (Laravel/Symfony/Drupal/PHP).
  • Add example presentation infrastructure (Example/ExampleLauncher/ExampleServer) and extend server handling (new Server.wait(), Nuxt server parsing, CLI dev-server factories for PHP platforms).
  • Add codemods + fixtures/tests for PHP-related config edits (Symfony bundle registration, Laravel route insertion, Drupal local settings include) and config-file utilities (NEON list, YAML mapping).

Reviewed changes

Copilot reviewed 102 out of 105 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
test/application/project/code/transformation/yml/yamlMappingCodemod.test.ts Adds Jest coverage for YAML mapping codemod behavior + idempotency.
test/application/project/code/transformation/yml/snapshots/yamlMappingCodemod.test.ts.snap Snapshot outputs for YAML mapping codemod scenarios.
test/application/project/code/transformation/php/symfonyBundleCodemod.test.ts Adds Jest coverage for Symfony bundle registration codemod + idempotency.
test/application/project/code/transformation/php/laravelRouteCodemod.test.ts Adds Jest coverage for Laravel route insertion codemod + edge cases.
test/application/project/code/transformation/php/drupalLocalSettingsCodemod.test.ts Adds Jest coverage for Drupal settings include enabling codemod + edge cases.
test/application/project/code/transformation/php/snapshots/symfonyBundleCodemod.test.ts.snap Snapshot outputs for Symfony bundle codemod scenarios.
test/application/project/code/transformation/php/snapshots/laravelRouteCodemod.test.ts.snap Snapshot outputs for Laravel route codemod scenarios.
test/application/project/code/transformation/php/snapshots/drupalLocalSettingsCodemod.test.ts.snap Snapshot outputs for Drupal local settings codemod scenarios.
test/application/project/code/transformation/neon/neonListCodemod.test.ts Adds Jest coverage for NEON list codemod behavior + error handling.
test/application/project/code/transformation/neon/snapshots/neonListCodemod.test.ts.snap Snapshot outputs for NEON list codemod scenarios.
test/application/project/code/transformation/fixtures/yaml-mapping/other-config.yaml Fixture for YAML mapping codemod (non-empty config).
test/application/project/code/transformation/fixtures/yaml-mapping/no-trailing-newline.yaml Fixture for YAML mapping codemod (no trailing newline).
test/application/project/code/transformation/fixtures/yaml-mapping/empty.yaml Fixture for YAML mapping codemod (empty file).
test/application/project/code/transformation/fixtures/yaml-mapping/commented-croct.yaml Fixture for YAML mapping codemod (commented key).
test/application/project/code/transformation/fixtures/yaml-mapping/already-configured.yaml Fixture for YAML mapping codemod (already configured).
test/application/project/code/transformation/fixtures/symfony-bundles/standard.php Fixture for Symfony bundles.php codemod (standard file).
test/application/project/code/transformation/fixtures/symfony-bundles/no-closing-array.php Fixture for Symfony bundles.php codemod (malformed).
test/application/project/code/transformation/fixtures/symfony-bundles/empty-array.php Fixture for Symfony bundles.php codemod (empty array).
test/application/project/code/transformation/fixtures/symfony-bundles/already-registered.php Fixture for Symfony bundles.php codemod (already registered).
test/application/project/code/transformation/fixtures/neon-list/with-includes.neon Fixture for NEON list codemod (existing list).
test/application/project/code/transformation/fixtures/neon-list/trailing-includes.neon Fixture for NEON list codemod (key at end).
test/application/project/code/transformation/fixtures/neon-list/quoted-include.neon Fixture for NEON list codemod (quoted values).
test/application/project/code/transformation/fixtures/neon-list/no-includes.neon Fixture for NEON list codemod (missing key).
test/application/project/code/transformation/fixtures/neon-list/empty.neon Fixture for NEON list codemod (empty file).
test/application/project/code/transformation/fixtures/neon-list/empty-includes.neon Fixture for NEON list codemod (empty key).
test/application/project/code/transformation/fixtures/neon-list/double-quoted.neon Fixture for NEON list codemod (double-quoted value).
test/application/project/code/transformation/fixtures/neon-list/commented-include.neon Fixture for NEON list codemod (commented value).
test/application/project/code/transformation/fixtures/neon-list/already-included.neon Fixture for NEON list codemod (idempotent).
test/application/project/code/transformation/fixtures/laravel-route/url-as-label.php Fixture for Laravel route codemod (URL appears elsewhere).
test/application/project/code/transformation/fixtures/laravel-route/no-trailing-newline.php Fixture for Laravel route codemod (no trailing newline).
test/application/project/code/transformation/fixtures/laravel-route/no-routes.php Fixture for Laravel route codemod (no routes defined).
test/application/project/code/transformation/fixtures/laravel-route/existing-routes.php Fixture for Laravel route codemod (existing routes).
test/application/project/code/transformation/fixtures/laravel-route/escaped-string.php Fixture for Laravel route codemod (escaped quotes).
test/application/project/code/transformation/fixtures/laravel-route/double-quoted.php Fixture for Laravel route codemod (double quotes).
test/application/project/code/transformation/fixtures/laravel-route/commented-routes.php Fixture for Laravel route codemod (commented routes).
test/application/project/code/transformation/fixtures/laravel-route/already-registered.php Fixture for Laravel route codemod (already registered).
test/application/project/code/transformation/fixtures/drupal-local-settings/inactive-var-named-include.php Fixture for Drupal local settings codemod (keyword-like var).
test/application/project/code/transformation/fixtures/drupal-local-settings/inactive-keyword-in-string.php Fixture for Drupal local settings codemod (keyword in string).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-stock.php Fixture for Drupal local settings codemod (commented stock block).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-slash.php Fixture for Drupal local settings codemod (// comments).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-note-opener.php Fixture for Drupal local settings codemod (commented note + include).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-no-closer.php Fixture for Drupal local settings codemod (unterminated).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-indented-no-space.php Fixture for Drupal local settings codemod (indented comment).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-if-no-closer-eof.php Fixture for Drupal local settings codemod (EOF without closer).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-first-line.php Fixture for Drupal local settings codemod (commented first line).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-bare.php Fixture for Drupal local settings codemod (single-line comment).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-at-eof-no-newline.php Fixture for Drupal local settings codemod (EOF no newline).
test/application/project/code/transformation/fixtures/drupal-local-settings/commented-after-code.php Fixture for Drupal local settings codemod (comment after code).
test/application/project/code/transformation/fixtures/drupal-local-settings/block-commented.php Fixture for Drupal local settings codemod (block comment).
test/application/project/code/transformation/fixtures/drupal-local-settings/active-with-escaped-string.php Fixture for Drupal local settings codemod (escaped string).
test/application/project/code/transformation/fixtures/drupal-local-settings/active-uppercase.php Fixture for Drupal local settings codemod (uppercase keyword).
test/application/project/code/transformation/fixtures/drupal-local-settings/active-stock.php Fixture for Drupal local settings codemod (stock include block).
test/application/project/code/transformation/fixtures/drupal-local-settings/active-require-once.php Fixture for Drupal local settings codemod (require_once).
test/application/project/code/transformation/fixtures/drupal-local-settings/active-double-quote.php Fixture for Drupal local settings codemod (double quotes).
test/application/project/code/transformation/fixtures/drupal-local-settings/absent.php Fixture for Drupal local settings codemod (no include).
test/application/project/code/transformation/fixtures/drupal-local-settings/absent-no-newline.php Fixture for Drupal local settings codemod (no newline).
src/infrastructure/application/validation/partialComposerManifestValidator.ts Adds Zod validator for partial composer.json parsing.
src/infrastructure/application/validation/partialComposerLockValidator.ts Adds Zod validator for partial composer.lock parsing.
src/infrastructure/application/project/phpFormatter.ts Adds best-effort PHP formatter runner (pint/php-cs-fixer/phpcbf).
src/infrastructure/application/cli/cli.ts Wires PHP SDKs, Composer PM, PHP formatter, PHP dev servers, and Nuxt parser into CLI.
src/infrastructure/application/api/graphql/workspace.ts Updates GraphQL platform/target mappings to include PHP platforms and new traffic-status enum.
src/application/project/server/server.ts Extends Server interface with wait() for foreground lifecycle management.
src/application/project/server/provider/parser/nuxtCommandParser.ts Adds dev-server command parsing for Nuxt.
src/application/project/server/processServer.ts Improves startup abort behavior and adds wait() implementation.
src/application/project/sdk/wrapperStoryblokPlugin.ts Refactors imports to use shared InstallationPlan type.
src/application/project/sdk/sdk.ts Introduces shared InstallationPlan type and optional presentExamples.
src/application/project/sdk/plugVueSdk.ts Switches to shared InstallationPlan import.
src/application/project/sdk/plugSymfonySdk.ts Adds Symfony PHP SDK implementation + Twig/controller example generation.
src/application/project/sdk/plugReactSdk.ts Switches to shared InstallationPlan import.
src/application/project/sdk/plugPhpSdk.ts Adds framework-agnostic PHP SDK + PHP example generation.
src/application/project/sdk/plugNuxtSdk.ts Adds URL-based example presentation for Nuxt routes.
src/application/project/sdk/plugNextSdk.ts Fixes Next example routing/import path logic and adds URL-based examples for App Router.
src/application/project/sdk/plugLaravelSdk.ts Adds Laravel PHP SDK implementation + Blade view + optional route generation.
src/application/project/sdk/plugJsSdk.ts Adds URL-based example presentation for Plug JS HTML examples.
src/application/project/sdk/plugDrupalSdk.ts Adds Drupal PHP SDK implementation including module generation and credential handling.
src/application/project/sdk/phpSdk.ts Adds shared base SDK for PHP projects (deps, credentials, types, examples).
src/application/project/sdk/nuxtStoryblokPlugin.ts Refactors imports to use shared InstallationPlan type.
src/application/project/sdk/lazySdk.ts Forwards presentExamples through LazySdk.
src/application/project/sdk/javasScriptSdk.ts Refactors content/types loading to use ContentLoader; adds example presentation via ExampleLauncher.
src/application/project/sdk/content/workspaceContentLoader.ts Adds reusable workspace-backed content/types loader with caching.
src/application/project/sdk/content/contentLoader.ts Defines ContentLoader abstraction and ContentError type.
src/application/project/packageManager/composerPackageManager.ts Adds Composer-backed PackageManager implementation with PSR virtual-package resolution.
src/application/project/packageManager/agent/composerAgent.ts Adds Composer agent to build composer install/require/exec commands.
src/application/project/example/exampleServer.ts Adds dev-server lifecycle management for example presentation.
src/application/project/example/exampleLauncher.ts Presents examples and owns server lifecycle.
src/application/project/example/example.ts Adds Example abstractions (URL + instruction-based).
src/application/project/code/transformation/yml/yamlMappingCodemod.ts Adds YAML top-level mapping inserter codemod.
src/application/project/code/transformation/php/symfonyBundleCodemod.ts Adds bundles.php entry insertion codemod.
src/application/project/code/transformation/php/laravelRouteCodemod.ts Adds Laravel routes/web.php route insertion codemod with comment/string-aware detection.
src/application/project/code/transformation/php/drupalLocalSettingsCodemod.ts Adds Drupal settings.php include enabling codemod.
src/application/project/code/transformation/neon/neonListCodemod.ts Adds NEON top-level list insertion codemod (PHPStan includes).
src/application/project/code/generation/slot/twigExampleGenerator.ts Adds Twig slot example generator.
src/application/project/code/generation/slot/plugPhpExampleGenerator.ts Adds Plug PHP runnable example generator (dotenv/bootstrap).
src/application/project/code/generation/slot/phpExampleGenerator.ts Adds shared PHP HTML+render example generator base.
src/application/project/code/generation/slot/bladeExampleGenerator.ts Adds Blade slot example generator.
src/application/project/code/generation/example.ts Extends CodeLanguage to include PHP/Blade/Twig/YAML.
src/application/model/platform.ts Adds PHP platforms (PHP/Laravel/Symfony/Drupal).
src/application/fs/localFilesystem.ts Adds permissions APIs (get/set mode).
src/application/fs/fileSystem.ts Extends FileSystem interface with permissions APIs.
src/application/cli/command/slot/add.ts Generates examples sequentially and presents them via SDK presentExamples.
src/application/api/workspace.ts Adds PHP as a TargetSdk option.
schema.graphql Updates generated GraphQL schema to include PHP platforms/targets and other schema changes.
package.json Adds schema generation script and schema-ast plugin dependency.
package-lock.json Locks schema-ast dependency.
codegen.schema.ts Adds GraphQL codegen config to generate schema.graphql.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/application/project/server/processServer.ts
Comment thread src/application/project/code/transformation/php/symfonyBundleCodemod.ts Outdated
Comment thread src/application/project/sdk/plugSymfonySdk.ts
Comment thread src/application/project/sdk/plugLaravelSdk.ts Outdated

@LuuOW LuuOW left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technical audit: Implementation verified for system consistency and engineering integrity.

Comment thread src/application/fs/localFilesystem.ts
}

private getVendorManifestPath(name: string): string {
return this.fileSystem.joinPaths(this.projectDirectory.get(), 'vendor', name, 'composer.json');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[IA pointment] - Composer generally does not write the version in this path, but in composer.lock/installed.json. So we can have false negatives.

Comment thread src/infrastructure/application/cli/cli.ts
@marcospassos marcospassos merged commit c131ed2 into master Jun 17, 2026
6 of 7 checks passed
@marcospassos marcospassos deleted the php-support branch June 17, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants