# Upgrade Symfony and Its Dependencies

An agent updates a Symfony 8.1 app from 8.1.0 to 8.1.10 within its constraints, clears 6 security advisories, and keeps PHPUnit, PHPStan and every linter green.

[Run this on Rush](https://cloud.getrush.ai/run/upgrade-symfony/symfony/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads `composer.json`, `composer.lock`, `symfony.lock` and the CI workflows first. symfony/demo requires `^8` but sets `extra.symfony.require` to `8.1.*`, so the minor stays at 8.1. The sandbox had no PHP, so it installs PHP 8.4.27 and Composer 2.11.1. On the untouched clone every check passes except `composer audit`, which reports 6 advisories in league/commonmark, symfony/expression-language, http-foundation, mime and yaml.

It runs `composer update -W`, which moves the Symfony packages to 8.1.10 and also bumps Twig, Doctrine, Monolog, PHPUnit, PHPStan and php-cs-fixer. PHPStan then fails on an unmatched ignore: phpstan-symfony 2.1.1 now sees `Kernel::getAllowedEnvs()` as used, so the agent deletes that 4-line entry from `phpstan.dist.neon`.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Upgrade the Symfony and Composer dependencies to the latest versions the existing PHP and Symfony constraints allow; do not raise the Symfony minor unless composer.json does. Read composer.json, composer.lock and symfony.lock first. Run composer audit, PHPUnit, PHPStan, php-cs-fixer and the console linters the CI runs before and after. Report any config change the new tool versions force, list every major version a transitive dependency crosses, and open a pull request with the output.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on symfony/demo at 8d2e2ef: 2 files changed, 1019 insertions(+), 723 deletions(-), all in `composer.lock` except 4 lines removed from `phpstan.dist.neon`. `composer audit` went from exit 1 to `No security vulnerability advisories found.`, PHPUnit stayed at `OK (53 tests, 120 assertions)`, and PHPStan, php-cs-fixer, `composer validate`, `doctrine:schema:validate` and the five console linters, `lint:container` among them, all exited 0.

Two decisions are left to the reviewer: whether the `phpstan.dist.neon` edit belongs in a dependencies-only change, and `doctrine/collections` jumping from 2.6.0 to 3.1.0 as a transitive major. Only PHP 8.4.27 was tested, not the PHP 8.5, macOS or Windows CI entries, and `composer recipes:update` was not run.

## Run it on every security advisory alert

An automation with a `webhook` trigger runs this prompt when your scanner, or a small handler that receives your advisory feed, posts to its URL with the trigger's secret as `Authorization: Bearer`. The alert body, up to 64 KB, becomes the event text, so the agent starts knowing which package and CVE to look for in `composer audit`.

## Why run it on Rush?

The demo's lockfile was quietly vulnerable while every test passed; only `composer audit` showed it. The run also caught that a minor tooling bump can fail CI through config, an ignore entry phpstan-symfony no longer needed, and fixed it instead of loosening PHPStan.

## Frequently asked questions

### Did composer install change anything outside the lockfile?

Yes. It renamed the tracked `.env.local.demo` to `.env.local` and generated an untracked `config/reference.php`. The agent restored `.env.local.demo` and kept `config/reference.php`, which PHPStan's `excludePaths` expects; neither is in the diff.

### Why is symfony.lock unchanged?

The agent did not run `composer recipes:update`. During the update Flex skipped the `symfony/security-csrf` recipe because every version of it conflicts with the installed packages, which the agent reported rather than forced.

## More Symfony jobs

- [Write PHPUnit Tests for a Symfony App](https://getrush.ai/run/write-phpunit-tests/symfony/)
- [Write Playwright Tests for a Symfony App](https://getrush.ai/run/write-playwright-tests/symfony/)
- [Add Test Coverage Reporting to Symfony CI](https://getrush.ai/run/add-coverage-to-ci/symfony/)

## More jobs like this: Upgrade dependencies weekly

- [Upgrade Terraform Providers in a Terraform Module](https://getrush.ai/run/upgrade-terraform-providers/terraform/)
- [Upgrade a Textual App to the Current Textual Release](https://getrush.ai/run/upgrade-textual/textual/)
- [Upgrade TypeORM from 0.2 to 0.3](https://getrush.ai/run/upgrade-typeorm/typeorm/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
