# Upgrade Laravel Dependencies Every Week

An agent updated BookStack's Composer lock one family at a time; all 1,625 tests and phpstan pass, and four upgrades wait on constraint changes.

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

## What the agent does

The agent reads `dev/docs/php-testing.md` and `composer.json`, installs PHP 8.3 from the sury.org apt repository with MariaDB 10.11 standing in for MySQL, and creates the `bookstack-test` database and user the doc describes. `composer refresh-test-database` refused to migrate under the production default in `app/Config/app.php`, so it runs with `APP_ENV=testing`.

On the untouched clone `php artisan test` ended `Tests:    32 failed, 1593 passed (7668 assertions)`: 31 in `Tests\Auth\LdapTest` (`Call to undefined function Tests\Auth\ldap_connect()`) and one in `ImageStorageTest` from the sandbox's 0077 umask. With `php8.3-ldap` installed and umask 022, it then runs `composer update <family> --with-dependencies` per family, with `php artisan test` and `composer check-static` after each.

## Start it with one API call

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

```json
{
  "agent": "claude",
  "input": "Upgrade this project's Composer dependencies to their latest compatible releases, keeping config.platform.php as it is. Update one package family at a time with composer update --with-dependencies. Set up MySQL with a bookstack-test database and user as dev/docs/php-testing.md describes and run composer refresh-test-database. After each update run php artisan test and composer check-static. Revert any update that fails either and record the failing test or phpstan error. Open one pull request listing each bump with its old and new version and each skipped upgrade with the error that blocked it.",
  "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 BookStackApp/BookStack at 045c6a98c: 1 file changed, 359 insertions(+), 272 deletions(-), all in `composer.lock`; `composer.json` and `config.platform.php` (8.3.0) are untouched. `laravel/framework` moved from v13.35.0 to v13.39.0, with phpunit 12.5.43, larastan v3.13.2, league/commonmark 2.10.7, guzzle 7.16.1 and five more families. After the last one, `php artisan test` ended `Tests:    1625 passed (8020 assertions)` and `composer check-static` printed `[OK] No errors`, both exit 0. No update failed, so none was reverted.

For the reviewer: four upgrades sit outside the declared constraints. `laravel/socialite` 5.31.0 needs `phpseclib ^4.0` while the root requires `^3.0`, so the two move only with a `composer.json` change; guzzle 8 and intervention/image 4 are majors the run did not attempt. No pull request was opened.

## Run it on every Monday at 09:00 UTC

An automation with a `schedule` trigger, `cron` `0 9 * * 1`, saves this request as its prompt. While the root requires `phpseclib ^3.0`, a socialite release that needs phpseclib 4 stays blocked and is listed with Composer's reason.

## Why run it on Rush?

The first test run here had 32 failures that had nothing to do with BookStack: no `ext-ldap` and a 0077 umask. The run traced both to the sandbox and got a clean baseline before updating anything. It also caught its own slip: phpstan flagged `app/Util/OutOfMemoryHandler.php:61` because `APP_ENV=testing` leaked into that step and a stale phpstan cache, and the run restarted from the original lock instead of reverting larastan over it.

## Frequently asked questions

### Why does `APP_ENV` matter?

`app/Config/app.php` defaults to production, `.env.example` sets no `APP_ENV`, and the test migration refuses to run there, so `composer refresh-test-database` and `php artisan test` run with `APP_ENV=testing`. phpstan must run without it, or it reports the unrelated `OutOfMemoryHandler.php:61` error.

### Why was socialite 5.31 left out?

Composer refused it: `laravel/socialite v5.31.0 requires phpseclib/phpseclib (^4.0)`, and BookStack requires `^3.0`. The run read "latest compatible" as within the constraints and changed only `composer.lock`. Its unopened pull request's description came back as an artifact; capture kept no `.diff`, so the lock diff did not.

## More Laravel jobs

- [Upgrade Laravel 11 to Laravel 13](https://getrush.ai/run/upgrade-framework-major/laravel/)
- [Write Playwright Tests for a Laravel App](https://getrush.ai/run/write-playwright-tests/laravel/)
- [Write Unit Tests for a Laravel Project](https://getrush.ai/run/write-unit-tests/laravel/)

## The same job on other stacks

- [Upgrade NestJS Dependencies Every Week](https://getrush.ai/run/upgrade-dependencies-weekly/nestjs/)
- [Upgrade Nuxt Dependencies Every Week](https://getrush.ai/run/upgrade-dependencies-weekly/nuxt/)
- [Upgrade Ruby on Rails Dependencies Every Week](https://getrush.ai/run/upgrade-dependencies-weekly/rails/)

## 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/)
