Agentic Coding for PHP Teams: Laravel, Symfony and WordPress
Short answer
Coding agents are productive in PHP when they know the framework's conventions and can verify their own work. Give them the exact test, static analysis and code style commands, describe how database migrations are created and reviewed, and use Rector and PHPStan for legacy upgrades. Never let an agent run migrations against shared or production databases.
One language, very different codebases
"PHP" covers a modern Laravel API with full test coverage, a Symfony application with Doctrine and strict typing, and a WordPress plugin that must run on many hosting setups. An agent needs different instructions for each, because the conventions and the ways to verify a change differ.
| Codebase | Conventions the agent must know | Verification |
|---|---|---|
| Laravel | Eloquent, Artisan generators, Form Requests, service container | php artisan test with Pest or PHPUnit, Pint for code style |
| Symfony | Bundles, dependency injection config, Doctrine entities and repositories | PHPUnit, bin/console lint:container, PHP-CS-Fixer |
| WordPress plugin | Actions and filters, prefixes, nonces, sanitizing and escaping | PHPCS with WordPress Coding Standards, Plugin Check |
Laravel also offers Laravel Boost, an MCP server with framework-specific guidance for agents, which is worth evaluating for Laravel teams.
What belongs in the instruction file
- Minimum supported PHP version and framework version, so the agent does not use syntax or APIs that are too new or too old.
- Code style tool and whether files use
declare(strict_types=1). - Where business logic lives: services, actions or controllers – agents otherwise put it wherever is closest.
- Composer rule: no new packages without approval, and
composer.lockstays committed. - The exact commands for a filtered test run, for example
php artisan test --filter=InvoiceTestorvendor/bin/phpunit --filter InvoiceTest.
Static analysis is your compiler
PHP has no compiler that catches type errors before runtime, so PHPStan or Psalm take that role in an agent workflow. Run them at the level the project already uses and include them in the commands the agent runs after every change. One rule is essential for legacy projects with a baseline file: the agent must fix new errors, never add them to the baseline or suppress them with ignore comments. State that explicitly – otherwise suppression is often the shortest path to a green check.
Be careful with tests that run against SQLite in memory while production uses MySQL or PostgreSQL. Queries generated by an agent can pass locally and fail on the real database.
Database migrations need a human gate
- The agent writes the migration; a developer reviews it before it runs anywhere shared.
- Laravel migrations get a working
down()method. In Symfony, review the SQL thatdoctrine:migrations:diffgenerates rather than trusting it blindly. - Split destructive changes such as dropping or renaming columns into several deployments, so old and new code can run side by side.
- Think about locks on large tables before adding indexes or columns.
- The agent's environment uses a local database with fake data – no credentials for staging or production.
Legacy PHP and WordPress security
For upgrades between PHP versions or framework majors, let Rector apply the mechanical changes and use the agent for the remainder. Before touching untested legacy code, have the agent write characterization tests that pin today's behavior. In WordPress code, review agent output with a security checklist: $wpdb->prepare() for queries, escaping functions like esc_html() on output, nonce checks with wp_verify_nonce() and capability checks with current_user_can(). Generated plugin code forgets these surprisingly often. Our guide on testing AI-generated code goes deeper.
How jocapps helps
neooutput runs hands-on workshops, team trainings and 1:1 consulting on agentic coding, in English and German, on-site or remote. PHP teams set up instruction files, static analysis gates and migration rules for their own stack and leave with working results. See the formats on our agentic coding workshops page, or book a free 30-minute intro call via the meeting planner.
Frequently asked questions
Do coding agents handle Laravel and Symfony well?
Yes, both are widely used and well represented in training data. Results improve noticeably when the instruction file pins versions and describes where logic belongs.
Should the agent be allowed to run migrations?
Only against a local development database with fake data. Migrations for shared environments should be reviewed and run through your normal deployment process.
How do agents help with old PHP code?
They are useful for writing characterization tests, explaining unfamiliar code and fixing what Rector cannot change automatically. Keep upgrades in small steps with tests in between.
Guides on this topic
Related solutions
- Agentic coding in teamsAgentic Coding for Data and Analytics Engineering Teams
- Agentic coding in teamsAgentic Coding for Java and Spring Teams
- Agentic coding in teamsAgentic Coding Workshops for Universities, Lecturers and Students
- Agentic coding in teamsAI Coding Agents for Embedded and Industrial Software
Talk to us about your project
Honest advice on your idea, prototype or app.
- 30 minutes
- Free
- No obligation
