Upgrade from 12 to 13
Are there breaking changes? It depends on the release:
- Version 13.0.0: requires PHP
^8.3instead of>=8.2. Itssrc/andconfig/files matchv12.0.5. See 13.0.0. - Releases 13.1 to 13.3 and
master: include behaviour changes. Composer installs the latest 13.x release, not 13.0.0, so review Changes in 13.x before deploying.
-
Check your PHP version. Version 13 requires PHP
^8.3; PHP 8.2 no longer works.Terminal window php -v -
Update Laravel and
nwidart/laravel-modulesto^13.0incomposer.json. Follow the Laravel 13 upgrade guide for application changes."require": {"laravel/framework": "^13.0","nwidart/laravel-modules": "^13.0"} -
Update both packages together:
Terminal window composer update laravel/framework nwidart/laravel-modules --with-all-dependenciesKeep your
wikimedia/composer-merge-pluginentries inextraandallow-plugins. Version 13 uses the same autoloading setup as version 12. -
Review Changes in 13.x and apply any items that affect your app. If you published
config/modules.phpor stubs, check Published config and stubs. -
Verify the installation:
Terminal window php artisan module:listEach module keeps the status it had before the upgrade.
Why update both together
Section titled “Why update both together”The package lists laravel/framework under require-dev only, so Composer does not block installing v12.0.5 alongside Laravel 13.
That combination is untested: 12.x targets Laravel 12 and 13.x targets Laravel 13. Updating both in one command keeps them aligned.
Published config and stubs
Section titled “Published config and stubs”A config/modules.php published from version 12 keeps working. No key was removed or renamed. Two optional keys were added on master:
paths.generator.job-middleware(added in 13.3.0; falls back to thejobspath plusMiddlewarewhen omitted).actuator.enabled(added after 13.3.0; defaults totrue, controls health indicator registration withnwidart/laravel-actuator).
Review these 13.2.0 config rules against your published file:
stubs.pathis ignored unlessstubs.enabledistrue.- A custom
app_folderand every class generatorpathmust agree, ormodule:makeexits with an error. - Setting
generatetofalsealso skips the stub files owned by that key. - The
registerkeys are deprecated and have no effect.
Behaviour updates to note on master
Section titled “Behaviour updates to note on master”If you track master or upgrade once these changes release, note three updates:
- Published config precedence: published
config/<module>.phpfiles now override module defaults. Matching associative arrays merge recursively, while scalars, lists, and[]replace the module value as a whole. - Inertia v3: Inertia stubs and
module:publish-inertiatarget Inertia v3 (script[data-page="app"], Svelte 5mount(), and ReactcreateElement). - Vite 8: newly generated modules use Vite 8 and
laravel-vite-plugin^3.1inpackage.json, and configure per-modulehotFileandmanifest: 'manifest.json'invite.config.js.
Published stubs
Section titled “Published stubs”Published stubs never update automatically. Compare your copies with src/Commands/stubs/ and merge changes you want:
- Changed between
v12.0.5andv13.3.0:command.stub,config.stub,job.stub,job-queued.stub,model.stub,route-provider.stub, andscaffold/provider.stub. - Changed after
v13.3.0(master):package.stub(Vite 8),vite.stub(hotFileandmanifest: 'manifest.json'),views/master.stub,inertia/*andmiddleware/handle-inertia-requests.stub(Inertia v3),scaffold/provider.stub($healthIndicators),event-provider.stub,routes/web.stub, andreplacement.stub. - New stubs (need no action; missing stubs fall back to package copies):
job-middleware.stub,resource-json-api.stub, andhealth-indicator.stub.
See 13.2.0, 13.3.0, and Unreleased (master) for details.
Deprecated code
Section titled “Deprecated code”Version 13.2.0 deprecates Module::boot(), Module::register(), and related methods and config keys. Post-13.3.0 changes on master also deprecate the Lumen classes and FileRepository::$stubPath, getStubPath(), and setStubPath(). All remain in 13.x and are removed in v14. Search your code for them: Deprecations.
If something fails
Section titled “If something fails”composer updatereports a conflict: check the package named in the error. The cause is usually another package without Laravel 13 support or a platform PHP constraint older than 8.3.- A module does not load after the update: run
composer dump-autoloadand check thatallow-pluginsstill allowswikimedia/composer-merge-plugin. modules_statuses.jsonthrowsInvalidJsonException: since 13.2.0, the file must hold a JSON object. See Changes in 13.x.
Version 12 stays on the 12.x branch for security fixes only. See Version compatibility.