- How do I install zonneplan/laravel-module-loader in a Laravel application?
- Install it with Composer as zonneplan/laravel-module-loader, and pin the constraint to ^7.1.1 rather than a floating ^7.0 so profiling sampling behavior cannot shift under a future release. If the package ships a publishable config file, publish it and commit the result so module discovery paths and the sampling key are explicit. Re-run php artisan config:cache as part of deployment so the new configuration takes effect.
- Which Laravel and PHP versions does Laravel Module Loader support?
- The package is a native Laravel package distributed through Composer, but the v7.1.1 release note does not list PHP or Laravel version constraints. Read the require block in composer.json and compare it against your runtime matrix before merging. Do not infer compatibility from the changelog alone.
- How does module discovery work, and do I need to register each service provider manually?
- Laravel Module Loader sits in the application bootstrap path and discovers modules from the locations you configure. It then registers and boots each module's service provider, so you do not hand-register every provider in a central AppServiceProvider. This keeps large codebases split into self-contained modules while preserving standard Laravel boot semantics.
- Can I enable or disable modules per environment?
- Yes. Modules can be enabled or disabled per environment, which is useful for keeping development-only or experimental modules out of production boots. Keep the environment-specific enable lists in configuration that is reconciled with your deploy pipeline. Verify that a missing or unknown module entry degrades gracefully rather than breaking boot.
- Does the package load module routes, configuration and migrations automatically?
- The loader registers each module's routes, configuration and migrations alongside its service provider. Migrations still run through the normal php artisan migrate flow rather than at boot. Because configuration is merged during registration, always re-run config:cache after changing module config or enabling a new module.
- What is the sampling rate setting added in v7.1.1 for module profiling?
- v7.1.1 adds a configurable sampling rate for module profiling, an opt-in observability feature rather than a change to discovery or boot semantics. The critical detail to confirm from the package config is the default: sampling disabled versus a rate of 1.0 meaning every profiling event is captured. Also check how the value is interpreted and whether samples go to a log channel, cache store or APM exporter.
- Will upgrading from v7.1.0 to v7.1.1 change production performance or behavior?
- It is a patch-level release, so it should be a routine composer update with lockfile review, but confirm whether an unconfigured upgrade changes profiling overhead from v7.1.0. Sampling exists to reduce profiling cost, so a silent default of full sampling would change production characteristics. Keep the upgrade in its own commit so rollback is a single revert of the lockfile and config, and canary it because profiling hooks run during provider registration.
- Do I need to run php artisan config:cache after adding the sampling config key?
- Yes. A stale configuration cache is the most plausible silent failure when adding a new key, so re-run php artisan config:cache on every deploy. Confirm that a missing key degrades gracefully instead of throwing during bootstrap. If you use OPcache preloading, verify there is no interaction with the cached config path.
- How should I test a Laravel app that uses modular service providers and profiling?
- Boot a test application with your module paths configured and assert that expected providers, routes and migrations are registered. For profiling, exercise the hooks at non-trivial sampling values including 0 and 1 so both the disabled and full-capture paths are covered. Set sampling deterministically in the test environment to avoid flaky timing-dependent assertions.
- Is zonneplan/laravel-module-loader a good alternative to manual provider registration in large Laravel apps?
- It is a reasonable fit when you want a modular monolith with automatic discovery of providers, routes, config and migrations plus per-environment module toggles. Compared with manually registering providers or adopting a broader module framework, it stays close to the standard Laravel lifecycle and imposes few layout assumptions. The v7.1.1 patch release indicates active maintenance, but review the changelog and repository activity before adopting, and skip this release entirely if you have no profiling or APM story yet.