nasirkhan/module-manager
Laravel module management for Laravel Starter: track module versions, handle migrations and updates, resolve dependencies, publish/enable/disable modules, scaffold/build modules, diff changes, and generate module tests via artisan commands.
Modules/{Module}/) and namespace isolation, aligning with Laravel’s service provider and autoloading conventions.laravel-jodit integration). If the base project diverges from Laravel Starter, customization overhead may arise.priority field in module.json enables load-order control, useful for core dependencies (e.g., Auth before Post). However, this requires discipline in configuration to avoid runtime conflicts.module:track-migrations) mitigates "migration drift" risks but adds complexity to CI/CD pipelines (e.g., requiring track-migrations in deployment scripts).vendor/nasirkhan/module-manager/src/Modules/.Modules/ via module:publish.Post). The package automatically rewrites namespaces during publishing, but this is a runtime behavior, not a compile-time check.A → B → A). This could lead to runtime errors if not manually validated.requires field is outdated, dependency satisfaction checks (module:dependencies) may fail silently.| Risk Area | Mitigation Strategy |
|---|---|
| Namespace Collisions | Enforce unique module aliases in module.json and validate during module:build. |
| Migration Drift | Automate module:track-migrations in pre-deployment hooks (e.g., GitHub Actions). |
| Performance Overhead | Profile module:status and module:dependencies commands for large module counts. |
| Laravel Starter Lock-in | Abstract Starter-specific logic (e.g., laravel-jodit) behind adapters if migrating away. |
| State Management | Backup Modules/ and database/migrations before major updates to vendor modules. |
Post v1.0 → v2.0 with breaking changes.)module:track-migrations be automated in CI or require manual intervention?module:publish --all) or selectively customize?composer update) be tested against published modules?module:status performance.)module:build).composer require nasirkhan/module-manager
php artisan module:build {ModuleName} # For new modules
php artisan vendor:publish --tag=module-manager-config # Publish config
Tag, Category) to test workflows.Auth, Post) with dependency validation.if (app(ModuleVersion::class)->isEnabled('Post')) {
require base_path('Modules/Post/routes/web.php');
}
| Component | Compatibility Notes |
|---|---|
| Laravel Packages | May conflict if they register routes/migrations without module awareness. |
| Custom Service Providers | Must defer to module managers or risk load-order issues. |
| Database Migrations | Existing migrations not tracked by default; require module:track-migrations. |
| Livewire/Blade | Works seamlessly if modules follow the Modules/{Module}/Resources/views/ structure. |
| API Routes | Requires module-aware route registration (e.g., Route::module('post', ...)). |
composer dump-autoload --optimize).php artisan vendor:publish --tag=module-manager-config
php artisan vendor:publish --tag=module-manager-migrations
php artisan module:build UserProfile
php artisan module:publish UserProfile
php artisan module:enable UserProfile
php artisan module:track-migrations UserProfile
php artisan migrate
# .github/workflows/ci.yml
- name: Check Module Dependencies
run: php artisan module:dependencies --fail-on-error
php artisan module:detect-updates --all
module.json.module:build).module:dependencies helps debug runtime errors early.module:diff, module:remove).module.json maintenance.php artisan module:status --allphp artisan module:dependencies {module}php artisan module:diff {module} --detailedHow can I help you explore Laravel packages today?