wandypurnomo/modularity
Laravel package for building modular applications with a clean module structure. Organize features into self-contained modules, manage module discovery and loading, and keep codebases scalable and maintainable.
illuminate/support). Assumes PSR-4 autoloading and Composer for module discovery.app/Modules/, lumens/ignition-style modules). May conflict with:
spatie/laravel-package-tools).laravel-migrations-generatorspatie/laravel-model-states| Risk Area | Mitigation Strategy |
|---|---|
| Namespace Collisions | Enforce strict module prefixes (e.g., App\Modules\Auth\...) in composer.json. |
| Performance Overhead | Benchmark module bootstrapping vs. monolithic approach. Use lazy-loading for non-critical modules. |
| Dependency Isolation | Test module autoloading in isolation (e.g., composer dump-autoload --optimize). |
| Legacy Code Impact | Gradual migration: Start with non-critical modules (e.g., reporting, analytics). |
| Documentation Gaps | Contribute to or create internal runbooks for module lifecycle (install, update, debug). |
Billing, Inventory) or technical layers (e.g., Auth, Payments)?orchestra/testbench for module-specific tests.| Laravel Component | Integration Strategy |
|---|---|
| Service Providers | Convert existing providers to module-aware (e.g., App\Modules\Auth\AuthServiceProvider). |
| Routes | Use Module::routes() or Module::web()/Module::api() for module-specific routes. |
| Middleware | Register middleware per module (e.g., Auth::middleware('auth')->module('auth')). |
| Views | Leverage Module::view() or namespace views (e.g., resources/modules/auth/views). |
| Migrations | Prefix migrations with module name (e.g., 2023_01_01_000000_create_auth_users_table.php in database/migrations/modules/auth/). |
| Commands/Jobs | Group Artisan commands and queue jobs under module namespaces (e.g., App\Modules\Auth\Console\...). |
| Events/Listeners | Use module-specific event namespaces (e.g., Auth\UserRegistered). |
Order, User)."scripts": {
"module:create": "php artisan module:make {name} --namespace=App\\Modules"
}
phpunit.xml per module).spatie/laravel-permission). Solutions:
Auth::module('legacy')->attempt()).Auth, User, Payment) to establish patterns.Logging, Notifications) last to avoid early abstraction.import('@modules/auth/components/Login')).Route::prefix('api/v1')) or GraphQL modules (e.g., rebing/graphql-laravel).composer require vendor/module:2.0.0).Auth, backend for Payments).php artisan module:status).php artisan module:disable).monolog with module prefixes).composer require vendor/module:1.2.0).php-dependency-graph, custom scripts).Auth module").Auth module on a separate Forge server).How can I help you explore Laravel packages today?