- How do I install and set up Module Manager in a Laravel 12/13 project?
- Run `composer require nasirkhan/module-manager` to install. Ensure your project uses PHP 8.3+ and Laravel 12/13. No additional configuration is needed for basic functionality—start with `php artisan module:status` to inspect existing modules.
- Can I use this package with a non-Laravel Starter project?
- While built for Laravel Starter, Module Manager works in any Laravel 12/13 project. However, some Starter-specific features (e.g., `laravel-jodit` integration) may require adjustments. Test thoroughly if migrating away from Starter.
- How does dependency resolution work if Module A requires Module B, but B isn’t installed?
- Use `php artisan module:dependencies` to check unsatisfied dependencies. The package validates `module.json` constraints but relies on Composer for actual installation. Circular dependencies (e.g., A → B → A) aren’t enforced—manually validate your module graph.
- What’s the difference between vendor modules and published modules?
- Vendor modules live in `vendor/nasirkhan/module-manager/src/Modules/` and are read-only. Publishing (`module:publish`) copies them to `Modules/` for customization. The package auto-rewrites namespaces to avoid collisions, but ensure your custom modules don’t clash with vendor module names.
- How do I handle migrations when updating a module to a new version?
- Run `module:track-migrations` before deploying to baseline the current state. After updating, use `module:detect-updates` to spot new migrations. Always back up `Modules/` and `database/migrations` before major updates to avoid drift.
- Can I selectively enable/disable modules at runtime?
- Yes. Use `module:enable {module}` and `module:disable {module}` to toggle modules dynamically. The `priority` field in `module.json` controls load order—set it carefully to avoid runtime conflicts (e.g., Auth before Post).
- How do I scaffold a new module with tests and migrations?
- Use `module:build {module-name}` to generate the skeleton. Add migrations manually or via Laravel’s `make:migration`. Generate tests with `module:make-test {module} {test-name} [--unit]` for unit or feature tests.
- What’s the best way to compare my published module with the upstream version?
- Run `module:diff {module} --detailed` to see changes between the published version and the latest upstream. This helps identify customizations that might break during updates. Automate this in CI to catch drift early.
- Does Module Manager support rollbacks for failed module updates?
- There’s no built-in rollback, but you can revert by restoring `Modules/` from version control or backups. Document your rollback steps in deployment scripts. For migrations, use Laravel’s `migrate:rollback` after disabling the module.
- Are there performance concerns with many modules (e.g., 100+)?
- Commands like `module:status` may slow down with large module counts. Profile performance and consider batching operations. For CI/CD, cache dependency checks (`module:dependencies`) if modules rarely change.