github nWidart/laravel-modules v13.4.0

45 minutes ago

Upgrade notes

Most apps need no changes. Open the block if you published config or stubs, use module Vite builds or Inertia, or extend the package.

Show upgrade notes

Action may be required

  • Application config now overrides module config. A published config/<module>.php wins over the module's own file (the module won before). Associative arrays merge recursively; lists, [] and scalars replace. Review your published copies and delete stale ones (#2275)
  • Unknown or missing module: commands print one error line and exit 1 instead of throwing ModuleNotFoundException. module:make-model -m/-c/... also exits 1 when a nested generator fails. Check the exit code in scripts instead of catching the exception (#2274)
  • module:prune --path is removed (it did nothing) and now fails with The "--path" option does not exist. Remove it from schedules and scripts (#2282)
  • Module vite.config.js must export paths. Without it the root build silently skips the module's assets (the loader now warns Skipping the assets of module X). Run php artisan vendor:publish --tag=vite --force, then port export const paths and import.meta.url into each existing module's vite.config.js and any published vite.stub. package.stub now generates Vite 8 and laravel-vite-plugin ^3.1, and vite.stub sets manifest: 'manifest.json'; set build.manifest: 'manifest.json' in modules that move to Vite 5+ (#2272, #2281)
  • Module npm run dev wrote public/hot and hijacked the app's @vite. vite.stub now sets hotFile: storage/vite-<module>.hot and views/master.stub passes storage_path('vite-<module>.hot') as the third argument of module_vite(). Add both to existing modules; with published stubs, merge vite.stub and views/master.stub together (#2285)
  • Inertia stubs target Inertia v3 only. Passing more than one of --vue, --react, --svelte exits 1. On Inertia v3 with an older published resources/js/app.js, re-run module:publish-inertia --force (it now asks before overwriting). On Inertia v2, keep your app.js and do not re-publish. Merge any published inertia/* stubs (#2276, #2283)

Behaviour changes

  • New modules' routes/web.php no longer wraps routes in middleware(['auth', 'verified']) (also with --inertia). Existing modules are untouched. Add the middleware yourself if you want it (#2262)
  • Each destructive command has its own prohibit flag (module:migrate-fresh, -refresh, -reset, -rollback, module:delete). One shared flag no longer blocks all of them, nor third-party confirmable commands built on BaseCommand. Use Module::prohibitDestructiveCommands() and call YourCommand::prohibit() for your own (#2264)
  • module:make-model --force also overwrites the files it generates (controller, factory, request, resource, seeder, policy) (#2302)
  • Module config merges in ModuleServiceProvider::register(). A custom registerConfig() override now runs earlier, so do not use boot-only services in it (#2292)
  • module:migrate-refresh --all refreshes enabled modules only (#2261)
  • module:make: --web wins over --plain and --api, make-migration --plain is honoured, and test namespaces drop the app folder when the test path is under app/ (#2259)
  • module:prune --model and --except resolve short names, --except now applies, and unknown values or modules exit 1 (#2279)
  • module:seed output changed: a header line, then INFO Module [X] seeded. or ERROR ... seeding failed.. Update scripts that parse it (#2273)
  • With nwidart/laravel-actuator installed, a modules health indicator can report DOWN (module enabled but missing on disk). Set modules.actuator.enabled to false to opt out. A modules actuator endpoint is registered (not exposed by default); rename an app endpoint with the id modules (#2287, #2286)
  • Laravel Boost guideline and skill moved to resources/boost/, so boost:install offers them (#2267)

Extending the package

  • replacement.stub generated $this->generator->getModule()->getLowerName(), which threw a TypeError. It now uses strtolower($this->generator->getName()). Fix a published stub and existing replacement classes. ModuleGenerator::getModule() returns ?RepositoryInterface: fix your overrides (#2257)
  • UnUseCommand no longer extends BaseCommand, so executeAction() and getInfo() overrides are dead; move the logic to handle(). forgetUsed() takes no required parameter: make your repository's parameter optional. modules.<name>.unused now fires (#2258)
  • module:install: modules.json entries may set their own path, and --path with more than one entry exits 1. InstallCommand::install() gains a fifth parameter ?string $path = null: update overrides (#2269)
  • Protected validateModules() returns bool. Update overrides (#2274)
  • Every generator gets --dry-run and --json (a command's own same-name options keep their meaning). In custom generators, writes that bypass FileGenerator still happen under --dry-run, and your methods named reportError, enterJsonMode, inJsonMode, writeJson or addGeneratorRunOptions may clash. FileGenerator::$overwriteFile defaults to false (#2299)

Deprecated (removed in v14)

  • Lumen classes: LumenModulesServiceProvider, Lumen\LumenFileRepository, Lumen\Module (#2278)
  • FileRepository::getStubPath(), setStubPath() and $stubPath never had an effect. Use modules.stubs.path or Stub::setBasePath() (#2260)

Features

  • actuator: Add module health indicators for nwidart/laravel-actuator (#2287) (ad58889)
  • actuator: Add a modules endpoint for nwidart/laravel-actuator (#2286) (9c437d9)
  • module-provider: Merge module config in register() (#2292) (13aa6b3)
  • commands: Add module:generators command with --json output (#2295) (871fa17)
  • commands: Add --dry-run to module:make and the generators (#2299) (361f1e7)
  • commands: Add --json option to module:migrate-status (#2297) (f541671)
  • commands: Add module:test command (#2298) (f9c1248)
  • commands: Add --json option to module:lang (#2296) (d1f8067)
  • commands: Add --json result output to module:make and the generators (#2300) (1641353)

Bug Fixes

  • make: Generate a replacement class that runs in module:make (#2257) (cdf54c3)
  • repository: Module:unuse needs no module name and fires the unused event (#2258) (3c6eab0)
  • make: Honour --plain on make-migration and --web on module:make (#2259) (2773f69)
  • commands: Correct help text, docblocks and dead declarations (#2260) (1d62583)
  • migrate-refresh: Use the enabled modules for --all (#2261) (6d9a63f)
  • stubs: Generate module web routes without auth middleware (#2262) (b167bb1)
  • stubs: Remove the unused $shouldDiscoverEvents from the module event provider (#2266) (14cae46)
  • boost: Ship the Boost guideline and skill where Boost reads them (#2267) (1623325)
  • phpunit-coverage: Handle an empty source element in phpunit.xml (#2268) (1df3a68)
  • install: Per-entry path in modules.json and clear errors (#2269) (52aae42)
  • model-show: Resolve a short model name in the modules (#2270) (9b4ac9b)
  • commands: Clean up generated output of seed, migration fields and component views (#2273) (5a6abac)
  • commands: Report an unknown module with one error line (#2274) (a927104)
  • commands: Give each destructive command its own prohibit flag (#2264) (ca1e243)
  • vite: Build module assets from the root vite.config.js (#2272) (2e6b8a9)
  • inertia: Mount the published app.js with Inertia v3 (#2276) (0fd78b4)
  • config: Let the application's config override a module's config (#2275) (bf88d60)
  • prune: Report unknown modules and resolve short model names in module:prune (#2279) (d2a3502)
  • stubs: Generate the module package.json with Vite 8 (#2281) (dbd42f9)
  • inertia: Make the React and Svelte stubs work with Inertia v3 (#2283) (66b003d)
  • prune: Remove the --path option of module:prune (#2282) (69d911d)
  • stubs: Make the Vite dev server of a module work with module_vite() (#2285) (342df07)
  • commands: Pass --force to the generators module:make-model calls (#2302) (a1525e5)

Performance

  • provider: Merge config first and skip boot work web requests do not need (#2291) (8954e0c)

Refactor

  • Deprecate the Lumen classes for removal in v14 (#2278) (9073ddf)

Documentation

  • Add learning on Dependabot version ranges and Laravel majors (#2250) (b0ab21e)
  • Add Starlight documentation site (#2255) (81934a1)
  • readme: Link the new documentation site (#2256) (8fb0c6b)
  • Add how-to guides (#2263) (153aad9)
  • Add Concepts, Upgrading and Ecosystem sections (#2265) (d7bbb69)
  • Add a security policy (#2271) (240720a)
  • Update the guides for the fixes merged after 13.3.0 (#2277) (beaf7cd)
  • site: Add per-page Open Graph images and social meta (#2284) (59f70a9)
  • Fix accuracy mismatches, tighten prose, and fill coverage gaps (#2293) (966363d)
  • Use FileTree for module and translation folder layouts (#2294) (5b0307a)

Other

  • Add Dependabot config for weekly Composer and GitHub Actions updates (#2249) (097480d)
  • Add PR-Agent reviewer using Claude Sonnet (#2253) (2980fb9)
  • Remove the trail code map tooling (#2254) (c04f0d4)

Don't miss a new laravel-modules release

NewReleases is sending notifications on new releases.