A module scaffolding tool for ERP-style Laravel applications.
LarMod provides an Artisan command to quickly generate fully-structured modules with controllers, models, services, routes, and more — giving your Laravel ERP project a clean, modular architecture from the start.
- PHP 8.2+
- Laravel 11 or 12
composer require cedarsol/larmod --devIf you're developing LarMod locally, add a path repository to your Laravel project's composer.json:
{
"repositories": [
{
"type": "path",
"url": "packages/larmod"
}
]
}Then require it:
composer require cedarsol/larmod --devNote: Laravel auto-discovers the service provider — no manual registration needed.
php artisan make:erp-module InventoryThis creates the following structure:
Modules/
└── Inventory/
├── Http/
│ ├── Controllers/
│ │ └── InventoryController.php
│ ├── Requests/
│ └── Resources/
├── Models/
│ └── Inventory.php
├── Services/
│ └── InventoryService.php
├── database/
│ └── migrations/
└── routes.php
| Option | Description |
|---|---|
--force |
Overwrite existing module files without prompt |
php artisan make:erp-module Inventory --forceAfter generating a module, add its namespace to your project's composer.json autoload:
{
"autoload": {
"psr-4": {
"App\\": "app/",
"Modules\\Inventory\\": "Modules/Inventory/"
}
}
}Then regenerate the autoloader:
composer dump-autoloadInclude the module's routes in your application. For example, in bootstrap/app.php (Laravel 11+):
->withRouting(
web: __DIR__.'/../routes/web.php',
api: __DIR__.'/../routes/api.php',
then: function () {
Route::prefix('api')
->middleware('api')
->group(base_path('Modules/Inventory/routes.php'));
},
)Or in a route service provider:
Route::prefix('api')
->middleware('api')
->group(base_path('Modules/Inventory/routes.php'));Publish the stub templates to customize them:
php artisan vendor:publish --tag=larmod-stubsThis copies the stubs to stubs/vendor/larmod/ in your project root. LarMod will use your customized stubs instead of the package defaults.
| Placeholder | Example Output | Description |
|---|---|---|
{{ namespace }} |
Modules\Inventory |
Module's root namespace |
{{ class }} |
Inventory |
StudlyCase module name |
{{ moduleName }} |
Inventory |
Module name (same as class) |
{{ moduleNameLower }} |
inventory |
Lowercase module name |
{{ moduleNameSlug }} |
inventory |
Kebab-case module name (URL-safe) |
{{ moduleNamePlural }} |
inventories |
Snake_case pluralized (for tables) |
cd packages/larmod
git init
git add .
git commit -m "Initial release of LarMod"
git remote add origin git@github.com:your-username/larmod.git
git push -u origin maingit tag v1.0.0
git push --tags- Go to https://packagist.org and sign in with GitHub
- Click Submit and enter your repository URL:
https://github.com/your-username/larmod - Packagist will read your
composer.jsonand register the package ascedarsol/larmod - Set up the GitHub webhook for automatic updates:
- In your GitHub repo → Settings → Webhooks → Add webhook
- Payload URL:
https://packagist.org/api/github?username=YOUR_PACKAGIST_USERNAME - Content type:
application/json - Secret: your Packagist API token
- Events: Just the push event
Once published, anyone can install it:
composer require cedarsol/larmod --dev# Generate modules for an ERP application
php artisan make:erp-module Inventory
php artisan make:erp-module Sales
php artisan make:erp-module HumanResource
php artisan make:erp-module Accounting
php artisan make:erp-module ProcurementEach module gets a clean, consistent structure ready for business logic.
MIT License. See LICENSE for details.