Skip to content

developerBino/larmod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LarMod

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.


Requirements

  • PHP 8.2+
  • Laravel 11 or 12

Installation

Via Composer (Packagist)

composer require cedarsol/larmod --dev

Local Development (Path Repository)

If 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 --dev

Note: Laravel auto-discovers the service provider — no manual registration needed.

Usage

Generate a Module

php artisan make:erp-module Inventory

This creates the following structure:

Modules/
└── Inventory/
    ├── Http/
    │   ├── Controllers/
    │   │   └── InventoryController.php
    │   ├── Requests/
    │   └── Resources/
    ├── Models/
    │   └── Inventory.php
    ├── Services/
    │   └── InventoryService.php
    ├── database/
    │   └── migrations/
    └── routes.php

Options

Option Description
--force Overwrite existing module files without prompt
php artisan make:erp-module Inventory --force

Register Module Namespace

After 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-autoload

Load Module Routes

Include 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'));

Customizing Stubs

Publish the stub templates to customize them:

php artisan vendor:publish --tag=larmod-stubs

This copies the stubs to stubs/vendor/larmod/ in your project root. LarMod will use your customized stubs instead of the package defaults.

Available Placeholders

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)

Publishing to Packagist

1. Create a GitHub Repository

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 main

2. Tag a Release

git tag v1.0.0
git push --tags

3. Register on Packagist

  1. Go to https://packagist.org and sign in with GitHub
  2. Click Submit and enter your repository URL: https://github.com/your-username/larmod
  3. Packagist will read your composer.json and register the package as cedarsol/larmod
  4. 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

4. Install from Packagist

Once published, anyone can install it:

composer require cedarsol/larmod --dev

Example Workflow

# 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 Procurement

Each module gets a clean, consistent structure ready for business logic.

License

MIT License. See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages