Looking to hire Laravel developers? Try LaraJobs

laravel-core-modules maintained by raza9798

Description
Laravel package for modular development, providing a structured approach to organizing models, controllers, migrations, and policies under a clean namespace like Core/. It simplifies scaffolding and enhances code separation for improved project structure.
Author
Last update
2026/07/15 19:17 (dev-main)
License
Links
Downloads
2

Comments
comments powered by Disqus

laravel-core-modules package.


📦 Laravel Core Modules

A lightweight Laravel package to generate and manage modular application structure using Artisan-based scaffolding.

It helps you organize Laravel applications into feature-based modules containing:

  • Controllers
  • Models
  • Migrations
  • Seeders
  • Factories
  • Requests
  • Policies

🚀 Installation

1. Install via Composer

$ composer require raza9798/laravel-core-modules
$ php artisan core-modules:install

2. Register Service Provider (if auto-discovery is disabled)

// config/app.php

'providers' => [
    Raza9798\LaravelCoreModules\CoreModulesServiceProvider::class,
],

3. Setup Modules Autoload (IMPORTANT)

Add this to your Laravel application's composer.json:

"autoload": {
    "psr-4": {
        "App\\": "app/",
        "Modules\\": "Modules/"
    }
}

Then run:

composer dump-autoload

⚙️ Configuration (Optional)

Publish config file:

php artisan vendor:publish --tag=laravel-core-modules-config

📁 Default Module Structure

When a module is created:

Modules/
└── Inventory/
    ├── app/
    │   ├── Http/
    │   │   └── Controllers/
    │   ├── Models/
    │   ├── Policies/
    ├── database/
    │   ├── migrations/
    │   ├── seeders/
    │   ├── factories/
    ├── routes/
    ├── tests/
    │   ├── Feature/
    │   ├── Unit/

🧑‍💻 Available Commands


📌 Create Module

php artisan module:create {name}

Example:

php artisan module:create Inventory

📌 Generate Module Files

php artisan module:make

Flow:

  • Select existing module OR create new one
  • Select artifact preset
  • Generate required files

📌 Artifact Options

When running module:make:

Select artifacts to generate:

✔ API Resource
✔ Database
✔ Custom

API Resource generates:

  • Controller
  • Model
  • Migration
  • Seeder
  • Factory

Database generates:

  • Model
  • Migration
  • Seeder
  • Factory

Custom generates:

  • Controller
  • Model
  • Migration
  • Seeder
  • Factory
  • (More coming)

🧪 Example Usage

Step 1: Create a module

php artisan module:create Inventory

Step 2: Generate files inside module

php artisan module:make

Example flow:

Select module:
> Inventory

Select artifacts:
> API Resource

Enter name:
> ItemMaster

Result:

Modules/Inventory/
├── app/Http/Controllers/ItemMasterController.php
├── app/Models/ItemMaster.php
├── database/migrations/...
├── database/seeders/...

⚠️ Important Notes

  • Requires PSR-4 autoloading for Modules\ namespace
  • Run composer dump-autoload after setup
  • Laravel base controller may be used inside modules

🤝 Contributing

Feel free to fork and improve the package.


📜 License

MIT License © Raza9798