triquang / laravel-solid-maker
Generate SOLID-based scaffolding (Service, Repository, Tests...) for Laravel — supports both standard and modular architectures.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/triquang/laravel-solid-maker
Requires
- php: ^8.0
- illuminate/support: ^11.0 || ^12.0
README
Laravel Solid Maker is a developer-friendly package for Laravel that allows you to quickly scaffold SOLID-structured boilerplate code across key architectural layers.
It supports both standard Laravel and modular Laravel architectures (e.g., using nwidart/laravel-modules).
✨ What It Generates
Database Layer
- Model
- Migration
- Factory
- Seeder
Flow Layer
- Controller
- Form Request (Store, Update)
- Resource
- Policy
Business Logic Layer
- Service
- Repository
- Repository Interface
Testing Layer
- Unit Test
- Feature Test
Binding
-
Interface bindings
*RepositoryServiceProvider- Standard Laravel: Register in
bootstrap/providers.php(first-time only, if needed). - Modular Laravel: Register in
module.json(first-time only, if needed).
- Standard Laravel: Register in
-
Auto-registrations
*DatabaseSeeder*routes/api.php*Policy*PHPUnittest suites
📦 Installation
This package is intended for development only.
Please install it using the --dev flag:
Install via Composer:
composer require triquang/laravel-solid-maker --dev
The service provider will be automatically registered.
(Optional) Publish the stubs if you want to customize the file templates:
php artisan vendor:publish --tag=solid-stubs
This will publish stub files to:
stubs/vendor/triquang/laravel-solid-maker
🚀 Usage
Generate a full set of SOLID-style files with:
php artisan make:solid-scaffold --model=YourModelName [--module=YourModuleName] [--view]
Options
| Option | Required | Description |
|---|---|---|
--model |
✅ Yes | Name of the Eloquent model (e.g., Post) |
--module |
❌ No | Module name (for modular Laravel projects) |
--view |
❌ No | Generate web.php routes instead of api.php |
Example
php artisan make:solid-scaffold --model=Post --module=Blog
This will generate and register:
- Database Layer: Model, Migration, Factory, Seeder
- Request Layer: Store & Update Form Requests
- Presentation Layer: Controller, Resource, Policy
- Business Logic: Service, Repository, Interface
- Testing: Unit Test, Feature Test
- Bindings & Registrations:
RepositoryServiceProviderBlogDatabaseSeedermodule.jsonroutes/api.php
📁 Folder Structure
Create Post SOLID scaffold in Modules\Blog
Project
├── phpunit.xml // register if exists
└── Modules
└── Blog
├── app
│ ├── Http
│ │ ├── Controllers
│ │ │ └── PostController.php
│ │ ├── Requests
│ │ │ ├── StorePostRequest.php
│ │ │ └── UpdatePostRequest.php
│ │ └── Resources
│ │ └── PostResource.php
│ ├── Models
│ │ └── Post.php
│ ├── Policies
│ │ └── PostPolicy.php
│ ├── Providers
│ │ ├── BlogServiceProvider.php // register or create
│ │ └── RepositoryServiceProvider.php // register or create
│ ├── Repositories
│ │ ├── Contracts
│ │ │ └── PostRepositoryInterface.php
│ │ └── PostRepository.php
│ └── Services
│ └── PostService.php
├── database
│ ├── factories
│ │ └── PostFactory.php
│ ├── migrations
│ │ └── YYYY_mm_dd_His_create_posts_table.php
│ └── seeders
│ ├── BlogDatabaseSeeder.php // register or create
│ └── PostSeeder.php
├── module.json // register or create
├── routes
│ └── api.php // register or create
└── tests
├── Feature
│ └── PostTest.php
└── Unit
└── PostServiceTest.php
🛠 Customizing the Stubs
Once published, you can edit stub templates at:
stubs/vendor/triquang/laravel-solid-maker
Your future generated files will reflect those customizations.
🧭 Auto-Generated Code Markers
This package adds clear flags in generated code to help developers easily find and review them.
Example
// AUTO-GEN: Placeholder public function getAll() { return $this->repository->getAll(); }
Available Markers
// AUTO-GEN-4-SOLID// AUTO-GEN: PlaceholderAUTO-GEN: Placeholder - Incomplete test.
You can quickly search these markers (Ctrl/Cmd+Shift+F) to locate auto-generated code and remove them after review.
✅ Requirements
- PHP >= 8.0
- Laravel 11 / 12
- Composer
📄 License
MIT © Nguyễn Trí Quang
🙌 Contributing
PRs are welcome! Feel free to improve functionality or report issues via GitHub Issues.
📬 Contact
- GitHub: github.com/ntquangkk
- Email: ntquangkk@gmail.com