atilla / submodules
A Laravel package for generating and managing modular API applications
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/atilla/submodules
Requires
- php: >=8.1
- illuminate/console: ^9.0|^10.0|^11.0
- illuminate/filesystem: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.5|^10.0
README
A Laravel package for generating modular API applications.
Installation
Install via Composer:
composer require atilla/submodules
The package will automatically register its service provider.
Configuration
Publish the configuration file:
php artisan vendor:publish --tag=submodules-config
This will create config/submodules.php where you can customize:
- Modules path
- Base namespace
- Directory structure
- Files to generate
- Route configurations
- View settings
Usage
Creating a Module
php artisan make:module Blog
This will generate a new module with the following structure:
src/SubModules/Blog/
├── Controllers/
│ └── BlogController.php
├── Models/
│ └── Blog.php
└── Providers/
└── BlogServiceProvider.php
... etc
Options
--force- Overwrite existing module
Generated Files
Each module includes:
- ServiceProvider
- Controller with CRUD + API actions
- Eloquent Model
- Basic routing configuration
Customization
Custom Stubs
Publish the stub files to customize the generated code:
php artisan vendor:publish --tag=module-generator-stubs
Configuration
Key settings in config/submodules.php:
return [ 'submodules_path' => 'src/SubModules', 'namespace' => 'SubModules', 'structure' => [ 'Controllers', 'Models', 'Providers', // More to come... ], 'files' => [ 'service_provider' => true, 'controller' => true, 'model' => true, // Configure which files to generate... ] ];
Requirements
- PHP 8.1+
- Laravel 9.0+