internachi/modular
A lightweight module system for Laravel using Composer path repositories and Laravel package discovery. Organize large apps by placing self-contained “modules” in an app-modules/ directory, following standard Laravel package conventions with minimal extra tooling.
app-modules/). This avoids reinventing Laravel’s ecosystem (e.g., service providers, facades) and leverages existing tooling (e.g., make:, migrations, Blade components).Modules\ namespace, app-modules/ directory) but allows customization via config publishing. This reduces boilerplate while maintaining flexibility.composer require) minimize initial integration effort. The modules:sync command further reduces manual configuration (e.g., PhpStorm, PHPUnit).Modules\ namespace (via config) mitigates risks, but poorly named modules could still cause conflicts. Mitigation: Enforce organization-specific prefixes (e.g., App\Modules\).app-modules/). The modules:cache command optimizes this, but large projects may need profiling. Mitigation: Benchmark in staging before production.modules:sync improves PhpStorm integration, other IDEs (e.g., VSCode) may require manual configuration. Mitigation: Document IDE-specific setups in the team’s onboarding.Migration Strategy:
Dependency Management:
composer.json per module)? Will we use Composer’s replace or provide to avoid duplication?Testing and CI/CD:
phpunit.xml per module) or a monolithic suite with namespaced tests?Performance and Scaling:
modules:cache command be sufficient, or do we need a custom solution (e.g., caching in Redis)?Team Adoption:
--module flags, namespace conventions)? Will we create internal docs or a sandbox environment?Long-Term Maintenance:
remove or archive modules in a separate branch?.env files)? Will we use Laravel’s config caching or a custom solution?replace syntax).modules:sync (adds Modules test suite). Supports PestPHP and other test frameworks if they follow Laravel conventions.Assessment Phase:
Pilot Phase:
internachi/modular in a staging environment.make:module).--module flags).Incremental Rollout:
Users, Payments) into modules.Finalization:
modules:list, modules:cache).app/Modules/) may need refactoring to fit app-modules/ conventions.Modules\Users\Database\Seeders\UsersTableSeeder).<x-users::profile />).Pre-Migration:
php artisan vendor:publish --tag=modular-config) and customize the module namespace (e.g., App\Modules\).php artisan modules:sync to update PHPUnit/PhpStorm configs.Module Creation:
php artisan make:module [name].app-modules/[name]/ and update composer.json.Dependency Management:
composer.json (e.g., require: "spatie/laravel-permission": "^5.0").replace to avoid duplication (e.g., shared libraries).Testing:
phpunit.xml to include module paths.Deployment:
composer update modules/[name] for module-specific updates.modules:cache in production to optimize auto-discovery.composer update modules/users).config/modules.php (if using custom stubs).php artisan config:cache) for performance.modules/archive/ directory or a separate Git branch.remove to uninstall modules (e.g., composer remove modules/legacy-module).How can I help you explore Laravel packages today?