raza9798/laravel-core-modules
Composer 安装命令:
composer require raza9798/laravel-core-modules
包简介
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.
关键字:
README 文档
README
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-autoloadafter setup - Laravel base controller may be used inside modules
🤝 Contributing
Feel free to fork and improve the package.
📜 License
MIT License © Raza9798
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-14