Download the PHP package sinemacula/laravel-modules without Composer
On this page you can find all versions of the php package sinemacula/laravel-modules. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sinemacula/laravel-modules
More information about sinemacula/laravel-modules
Files in sinemacula/laravel-modules
Package laravel-modules
Short Description A lightweight, convention-driven modular architecture package for Laravel - auto-discovers modules as directories with zero manifests, zero boilerplate, and nothing new to learn.
License Apache-2.0
Informations about the package laravel-modules
Laravel Modules
A lightweight, convention-driven modular architecture package for Laravel. Replaces the standard app/ directory with a
modules/ directory where each subdirectory is a self-contained module following standard Laravel conventions.
Modules are auto-discovered at boot time and cached for performance. All standard Laravel conventions work inside each module — there is no new API to learn.
How It Works
Each subdirectory under modules/ is a self-contained module with its own models, controllers, routes, commands,
listeners, events, observers, policies, and more:
What Gets Discovered
| Convention | Module Path | How It's Loaded |
|---|---|---|
| Routes | Http/routes.php |
Passed to withRouting(api: ...) |
| Console commands | Console/Commands/ |
Glob-based via withCommands() |
| Scheduled tasks | Console/schedule.php |
Glob-based via withCommands() |
| Event listeners | Listeners/ |
Glob-based via withEvents() |
| Views | Resources/views/ |
Registered in ModuleServiceProvider |
| Translations | Resources/lang/ |
Registered in ModuleServiceProvider |
| Service providers | Providers/ |
Loaded via withProviders() |
Everything else — controllers, requests, resources, events, observers, policies, models, jobs, mail, notifications — works via PSR-4 autoloading. No registration required.
Artisan Commands
| Command | Description |
|---|---|
module:make {name} |
Scaffold a new module with the standard directory structure |
module:list |
List all discovered modules and their paths |
module:cache |
Cache discovered module paths for faster resolution |
module:clear |
Clear the cached module paths |
module:make Billing creates:
Module Caching
Module paths are cached to bootstrap/cache/modules.php and integrated into Laravel's optimize / optimize:clear
lifecycle:
Installation
1. Edit bootstrap/app.php
Replace the default Laravel application with the modular variant:
2. Update your autoload mapping
In your application's composer.json, point the PSR-4 autoload at the modules/ directory:
Then run composer dump-autoload.
3. Create the modules/ directory
Create a modules/ directory at your project root and add your first module:
4. Wire up routing
Each module defines its own routes in Http/routes.php. These are automatically discovered and passed to
withRouting() as shown in the bootstrap/app.php example above.
Requirements
- PHP ^8.3
- Laravel ^13.0
Testing
Contributing
Contributions are welcome via GitHub pull requests.
Security
If you discover a security issue, please contact Sine Macula directly rather than opening a public issue.
License
Licensed under the Apache License, Version 2.0.