triquang/laravel-solid-maker
Composer 安装命令:
composer require triquang/laravel-solid-maker
包简介
Generate SOLID-based scaffolding (Service, Repository, Tests...) for Laravel — supports both standard and modular architectures.
README 文档
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
triquang/laravel-solid-maker 适用场景与选型建议
triquang/laravel-solid-maker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「module」 「repository」 「service」 「interface」 「scaffold」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 triquang/laravel-solid-maker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 triquang/laravel-solid-maker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 triquang/laravel-solid-maker 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
repository php library
Laravel 5 - Repositories to the database layer
bootstrap select field module implementing http://silviomoreto.github.io/bootstrap-select/
Structure for the Laravel Service-Repository Pattern
Rinvex Repository is a simple, intuitive, and smart implementation of Active Repository with extremely flexible & granular caching system for Laravel, used to abstract the data layer, making applications more flexible to maintain.
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-27