smorken / module
Module loader for Laravel
v10.1.2
2024-07-31 17:07 UTC
Requires
- php: ^8.1
- illuminate/config: ^10.0|^11.0
- illuminate/support: ^10.0|^11.0
- smorken/support: ^10.0
- symfony/finder: ^6.0|^7.0
Requires (Dev)
- laravel/framework: ^10.0|^11.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.11.8
- phpunit/phpunit: ^10.0|^11.0
- smorken/docker: *
- spatie/laravel-ignition: ^2.0
README
License
This software is open-sourced software licensed under the MIT license
The Laravel framework is open-sourced software licensed under the MIT license
Installation
It should register itself automatically. If not, add to your config/app.php
:
...
'providers' => [
Smorken\Module\ServiceProvider::class,
...
Use
Add another namespace to your app (or create another directory under your app's namespace) for modules.
composer.json
"autoload": {
"psr-4": {
"App\\": "app/",
"Module\\": "modules/module/",
Update config/modules.php
<?php
return [
\Module\PC\Foo\Module::class,
\Module\PC\Bar\Module::class,
];
Directory structure:
- modules/module/PC/Foo
- _config
- config.php
- relations.php (
RelationProvider
) - storage.php (core providers,
Binder
,StorageProvider
) - views.php (
ViewProvider
)
- _resources
- views
- _routes
- api.php (if needed)
- web.php (if needed)
- Commands
- Contracts
- Database
- migrations
- Seeders
- Http
- Models
- Storage
- Module.php - registers module (via service provider;
registerMethods
property) - ServiceProvider.php - initialized by Module.php
- _config