Page MenuHomePhabricator

⏫ Update to Laravel 11
Open, HighPublic

Description

The Platform API runs Laravel 10 and should be updated to Laravel 11 which was released March 12th 2024: https://laravel.com/docs/11.x/upgrade#main-content

Laravel 10 reached EOL February 4th 2025 (https://laravel.com/docs/11.x/releases)

Steps to do this include:

  • read through the official upgrade guide
  • update composer packages - see Upgrade Guide Steps section below
    • Remember to view the release notes / update guide of any other dependencies that also need updating and update this task description
  • address issues in upgrade guide - see Upgrade Guide Steps section below
  • adapt the codebase to breaking or deprecated changes

Upgrade Guide Steps

Here are all the headings from https://laravel.com/docs/11.x/upgrade and either what we need to take or what we need to investigate further. We will cross these out as we go.

Other changes required when updating to Laravel 11.x

Here are tasks we know we need to do when updating to Laravel 11.x that aren't covered by the upgrade guide:

  • Update absszero/laravel-stackdriver-error-reporting configuration (see the README)

How shall we split this task up?

  • In the past this has always been a non-parallelizable task
  • Some devs could start doing the update of the known steps, while others look at the investigation steps
  • Alternatively, as there are only 3 of us working, we could do mob programming (and "pass the development staff"). We will need to be very diligent at pushing changes at the end of sessions.

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Tarrow raised the priority of this task from Medium to High.Mar 14 2025, 4:26 PM
Tarrow updated the task description. (Show Details)

Laravel 11 Security updates will only last until March 2026 so when this gets worked on its probably best to do a successive update to Laravel 12, like we did in the past with v9 and v10 as well. https://laravel.com/docs/12.x/releases#support-policy

https://phabricator.wikimedia.org/T341796
https://phabricator.wikimedia.org/T341797

While waiting for a train I took some crude notes about what I saw relevant from the upgrade guide. A hidden gem in those guides is the last section, where it links to a diff of the core app skeleton. I think it's healthy to try to adjust as much as it makes sense to that with each major version upgrade: https://github.com/laravel/laravel/compare/10.x...11.x

#### Dependencies
- PHP 8.2.0 minimum
- curl 7.34.0 minimum
##### composer updates
- `laravel/framework` to `^11.0`
- `nunomaduro/collision` to `^8.1`
- `laravel/passport` to `^12.0` (If installed)

- check if remove doctrine/dbal is possible
#### Publish migrations
review changes: https://laravel.com/docs/11.x/upgrade#passport
run php artisan vendor:publish --tag=passport-migrations

#### review `casts` propteries due to new method
https://laravel.com/docs/11.x/upgrade#eloquent-model-casts-method

#### Consider update to Carbon 3
https://laravel.com/docs/11.x/upgrade#carbon-3
review usage of `diffIn` methods

## Middleware
https://laravel.com/docs/11.x/releases#middleware
- move to `bootstrap/app.php` ?

## Scheduling
https://laravel.com/docs/11.x/releases#scheduling
- move scheduled tasks to `routes/conole.php` from kernel class

### compare and include core changes
https://github.com/laravel/laravel/compare/10.x...11.x
- move Kernel and Exceptions/Handler.php files into ... app? 

# Optional improvements

## Use new dedicated MariaDb driver
https://laravel.com/docs/11.x/releases#mariadb

## Health check
https://laravel.com/docs/11.x/releases#health

## Increase bcrypt hashing work factor
https://laravel.com/docs/11.x/releases#automatic-password-rehashing

## Improve testing via FakeQueueInteractions
https://laravel.com/docs/11.x/releases#queue-interaction-testing

## Squash migrations
https://laravel.com/docs/11.x/migrations#squashing-migrations
Tarrow updated the task description. (Show Details)

tarrow opened https://github.com/wbstack/api/pull/1101

chore(deps): bump timacdonald/log-fake from ^2.1 to ^2.3

tarrow closed https://github.com/wbstack/api/pull/1101

chore(deps): bump timacdonald/log-fake from ^2.1 to ^2.3

tarrow opened https://github.com/wbstack/api/pull/1102

chore(deps): bump barryvdh/laravel-ide-helper from 2.13 to ^3

tarrow closed https://github.com/wbstack/api/pull/1102

chore(deps): bump barryvdh/laravel-ide-helper from 2.13 to ^3

Tarrow moved this task from Doing to Todo on the Wikibase Cloud (Kanban Board) board.
Tarrow subscribed.

Paused while we work on an incident

Rosalie_WMDE moved this task from Doing to Todo on the Wikibase Cloud (Kanban Board) board.
Rosalie_WMDE subscribed.
dena removed Tarrow as the assignee of this task.Mon, May 18, 8:12 AM
dena moved this task from Doing to Todo on the Wikibase Cloud (Kanban Board) board.

Regading the application structure: I noticed the v11 Upgrade Guide mentions:

Laravel 11 introduces a new default application structure with fewer default files. Namely, new Laravel applications contain fewer service providers, middleware, and configuration files. However, we do not recommend that Laravel 10 applications upgrading to Laravel 11 attempt to migrate their application structure, as Laravel 11 has been carefully tuned to also support the Laravel 10 application structure.

https://laravel.com/docs/11.x/upgrade#application-structure

Which to me sounds like a longer-term commitment to supporting the v10 structure and we can keep it until further notice.