rahasistiyak/laravel-super-artisan
Composer 安装命令:
composer require rahasistiyak/laravel-super-artisan
包简介
A powerful Laravel scaffolding package — generate Models, Controllers, Repositories, APIs, Filament resources, Policies, Actions, and more with a single command. Includes a complete Workflow runner for Artisan command sequences.
关键字:
README 文档
README
The ultimate Laravel scaffolding & workflow package.
Generate complete resource stacks, run Artisan workflows, and supercharge your development speed.
What's New in v2.0
| Feature | v1 | v2 |
|---|---|---|
run:workflow command |
❌ Missing | ✅ Fully implemented |
| Repository pattern (full triad) | ⚠️ Partial | ✅ Class + Interface + Provider |
| Bulk generation | ❌ | ✅ make:super Post,Comment,Tag |
| API scaffolding | ❌ | ✅ --api |
| Filament resource | ❌ | ✅ --filament |
| Domain-driven layout | ❌ | ✅ --domain=Blog |
| Blueprint system | ⚠️ Config only | ✅ Fully executable |
--force / --dry-run |
❌ | ✅ Both supported |
make:super-request |
❌ | ✅ New command |
make:super-policy |
❌ | ✅ New command |
make:super-action |
❌ | ✅ New command |
super:list |
❌ | ✅ New DX helper |
| PHP & Laravel support | PHP 8.0+, L11-12 | PHP 8.2+, L11-12-13 |
Requirements
- PHP >= 8.2
- Laravel 11.x, 12.x, or 13.x
Installation
composer require rahasistiyak/laravel-super-artisan
Publish the config and stubs:
# Publish config (optional but recommended) php artisan vendor:publish --tag=super-artisan-config # Publish stubs (to customize templates) php artisan vendor:publish --tag=super-artisan-stubs
This creates:
config/super-artisan.php— Define your blueprints and workflows.stubs/vendor/super-artisan/— Customize every generated file template.
Available Commands
| Command | Description |
|---|---|
make:super {name} |
Generate a complete resource stack |
make:repository {name} |
Generate a repository (class + interface + provider) |
make:service {name} |
Generate a service class |
make:super-request {name} |
Generate a FormRequest |
make:super-policy {name} |
Generate a Gate policy |
make:super-action {name} |
Generate a single-responsibility Action |
run:workflow {name} |
Execute a predefined Artisan command workflow |
super:list |
List all available workflows and blueprints |
make:super — Resource Generator
Signature
php artisan make:super {name} [options]
Options
| Option | Description |
|---|---|
{name} |
Resource name(s). Comma-separate for bulk: Post,Comment,Tag |
--livewire |
Generate a Livewire component |
--vue |
Generate a Vue 3 component |
--react |
Generate a React component |
--api |
Generate an API resource controller (JSON responses) |
--filament |
Generate a Filament v3 resource |
--pattern=repository |
Apply the Repository pattern (class + interface + binding) |
--pattern=service |
Apply the Service pattern |
--blueprint={key} |
Run a named blueprint from config |
--domain={Name} |
Place files under a domain namespace |
--path={path} |
Base path for controllers and views |
--controller_path={path} |
Controller subfolder |
--model_path={path} |
Model subfolder |
--view_path={path} |
View/component subfolder |
--migration_path={path} |
Migration subfolder |
--force |
Overwrite existing files |
--dry-run |
Preview what would be generated without writing |
--interactive |
Prompt for options interactively |
Examples
Basic CRUD (Blade Views)
php artisan make:super Post
Generates: Model, Migration, Factory, Controller, 4 Blade views
Bulk Generation
php artisan make:super Post,Comment,Tag
Generates the full stack for all three resources at once.
API Resource
php artisan make:super Post --api
Generates: Model, Migration, Factory, API Controller (JSON responses, no views)
Repository Pattern
php artisan make:super Post --pattern=repository
Generates: Model + Migration + Repository class + Interface + RepositoryServiceProvider binding + Controller with DI
Filament Resource
php artisan make:super Post --filament
Generates: Model + Migration + Filament v3 Resource (requires filament/filament)
Domain-Driven Layout
php artisan make:super Post --domain=Blog
Generates: app/Http/Controllers/Blog/PostController.php, views in resources/views/Blog/post/
Livewire
php artisan make:super Post --livewire
Vue / React
php artisan make:super Post --vue php artisan make:super Post --react
Blueprint
php artisan make:super Post --blueprint=full-stack
Runs the full-stack blueprint: Model + Repository + Policy + FormRequests + Controller.
Dry Run
php artisan make:super Post --api --domain=Blog --dry-run
Preview exactly what would be created — nothing is written to disk.
Force Overwrite
php artisan make:super Post --force
run:workflow — Workflow Runner
Execute predefined sequences of Artisan commands.
Signature
php artisan run:workflow {workflow} [options]
Options
| Option | Description |
|---|---|
--name={value} |
Substitute {name} token in workflow commands |
--dry-run |
Show the commands without running them |
--stop-on-failure |
Stop the workflow if any step fails |
--list |
List all available workflows |
Built-in Workflows
| Workflow | Description |
|---|---|
deploy |
Clear caches, run migrations, rebuild caches, take app back up |
fresh |
Wipe and re-seed the database (dev only) |
optimize |
Rebuild all application caches |
clear |
Clear all caches |
test |
Run the test suite |
test-and-deploy |
Run tests then deploy (use --stop-on-failure) |
queue-restart |
Gracefully restart queue workers |
ide-helper |
Regenerate IDE helper files |
Examples
# Standard deployment php artisan run:workflow deploy # Preview what deploy would do php artisan run:workflow deploy --dry-run # Test then deploy, stop if tests fail php artisan run:workflow test-and-deploy --stop-on-failure # Fresh database for local dev php artisan run:workflow fresh # List all workflows php artisan run:workflow deploy --list # or php artisan super:list
make:repository — Repository Generator
Generates the full repository triad:
- Repository class (
app/Repositories/{Name}Repository.php) - Interface (
app/Repositories/Contracts/{Name}RepositoryInterface.php) - Service Provider binding (
app/Providers/RepositoryServiceProvider.php)
php artisan make:repository PostRepository --model=Post
Options
| Option | Description |
|---|---|
--model= |
Model to use (auto-inferred from name if omitted) |
--no-interface |
Skip generating the interface |
--no-binding |
Skip updating RepositoryServiceProvider |
--force |
Overwrite existing files |
--dry-run |
Preview output |
After generation: Add
RepositoryServiceProvider::classtobootstrap/providers.php(Laravel 11+).
make:service — Service Generator
php artisan make:service PostService --model=Post
Generates: app/Services/PostService.php with typed methods and constructor injection.
Additional Generators
make:super-request
php artisan make:super-request StorePostRequest --rules=title:required,body:required|max:500
Generates: app/Http/Requests/StorePostRequest.php with pre-filled validation rules.
make:super-policy
php artisan make:super-policy PostPolicy --model=Post
Generates: app/Policies/PostPolicy.php with all standard Gate methods (viewAny, view, create, update, delete, restore, forceDelete).
make:super-action
php artisan make:super-action CreatePost --model=Post
Generates: app/Actions/CreatePost.php — a single-responsibility action class.
super:list — Discovery Helper
# List all workflows php artisan super:list # List all blueprints php artisan super:list --blueprints # List everything php artisan super:list --all
Blueprints
Blueprints define reusable file-generation templates. Define your own in config/super-artisan.php.
Built-in Blueprints
| Blueprint | Description |
|---|---|
crud |
Model + Migration + Factory + Resource Controller |
api-resource |
Model + Migration + Factory + API Controller |
repository-crud |
Full CRUD with Repository pattern |
livewire |
Model + Migration + Livewire component |
filament-resource |
Model + Migration + Filament resource |
full-stack |
Model + Repository + Policy + FormRequests + Controller |
Custom Blueprint Example
// config/super-artisan.php 'blueprints' => [ 'my-api' => [ 'description' => 'My custom API resource.', 'commands' => [ 'make:model {name} -m -f', 'make:super-request Store{name}Request', 'make:super-request Update{name}Request', 'make:super {name} --api', ], ], ],
php artisan make:super Product --blueprint=my-api
Custom Workflows
// config/super-artisan.php 'workflows' => [ 'my-deploy' => [ 'description' => 'My custom deployment steps.', 'commands' => [ 'down', 'migrate --force', 'db:seed --class=ProductionSeeder', 'optimize', 'up', ], ], ],
php artisan run:workflow my-deploy --stop-on-failure
Customizing Stubs
After publishing, edit stubs in stubs/vendor/super-artisan/:
| Stub | Purpose |
|---|---|
view_index.stub |
Blade index view |
view_create.stub |
Blade create view |
view_edit.stub |
Blade edit view |
view_show.stub |
Blade show/detail view |
vue_component.stub |
Vue 3 SFC component |
react_component.stub |
React functional component |
repository.stub |
Repository class |
repository_interface.stub |
Repository interface |
repository_controller.stub |
Controller with repository DI |
api_controller.stub |
API resource controller |
service.stub |
Service class |
action.stub |
Action class |
policy.stub |
Gate policy |
request.stub |
FormRequest |
filament_resource.stub |
Filament v3 Resource |
Available Tokens
| Token | Example Output |
|---|---|
{{ name }} |
Post |
{{ lower_name }} |
post |
{{ plural }} |
Posts |
{{ lower_plural }} |
posts |
{{ snake_name }} |
post |
{{ snake_plural }} |
posts |
{{ kebab_name }} |
post |
{{ ns_prefix }} |
\Admin (or empty) |
Repository Pattern — How It Works
When using --pattern=repository or make:repository, the package generates:
-
Repository class — Implements
RepositoryInterfacefrom the package withall(),find(),findOrFail(),create(),update(),delete(),paginate(),firstWhere(),count(). -
Repository interface — Extends the base
RahasIstiyak\SuperArtisan\Contracts\RepositoryInterface. Add model-specific methods here. -
Service provider binding — Binds the interface to the concrete class via IoC. Register it in
bootstrap/providers.php:
// bootstrap/providers.php return [ App\Providers\AppServiceProvider::class, App\Providers\RepositoryServiceProvider::class, // 👈 Add this ];
- Controller with DI — The generated controller receives the repository interface via constructor injection, promoting testability and loose coupling.
Testing
vendor/bin/phpunit
Run tests with coverage:
vendor/bin/phpunit --coverage-text
Contributing
Contributions are welcome! Please submit pull requests or issues to the GitHub repository.
Please follow the existing code style and write tests for any new features.
License
This package is licensed under the MIT License.
Contact
Email: rahasistiyak.official@gmail.com
GitHub: rahasistiyakofficial
rahasistiyak/laravel-super-artisan 适用场景与选型建议
rahasistiyak/laravel-super-artisan 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 5, 最近一次更新时间为 2025 年 06 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「api」 「workflow」 「blueprint」 「laravel」 「domain」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 rahasistiyak/laravel-super-artisan 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rahasistiyak/laravel-super-artisan 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 rahasistiyak/laravel-super-artisan 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Workflow for NetCommons Plugin
Workflow logger
A PSR-7 compatible library for making CRUD API endpoints
Approval Workflow Engine for Filament
Operational approvals engine for Laravel applications.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-26