timwassenburg/laravel-improved-resource-controllers
Composer 安装命令:
composer require timwassenburg/laravel-improved-resource-controllers
包简介
Generate complete resource controllers
README 文档
README
Table of Contents
Features
This simple package extends the php artisan make:controller command and generates
resource controllers with working resource functions out of the box to prevent you from writing
the same basic controller functions over and over again.
Keep in mind the improved resource controllers are only meant as a starting point.
You still have to add your own routes, validation, migrations, etc.
Getting started
Installation
Require the package with composer.
composer require timwassenburg/laravel-improved-resource-controllers --dev
Publish config (optional)
php artisan vendor:publish --provider="TimWassenburg\ImprovedResourceControllers\ImprovedResourceControllersServiceProvider" --tag="config"
Publish stubs (optional)
To change the generated resource controllers you can override the stubs and adjust it to your liking. The stubs will be stored in /resources/stubs.
php artisan vendor:publish --provider="TimWassenburg\ImprovedResourceControllers\ImprovedResourceControllersServiceProvider" --tag="stubs"
Usage
The idea behind this package is that you can keep using the make:controller commands you are already used to. So no need to change your muscle memory. Checkout the example output to see the result for each command.
Default resource controller
php artisan make:controller CustomerController --resource
Default API resource controller
php artisan make:controller CustomerController --resource --api
Model resource controller
php artisan make:controller CustomerController --resource --model=Customer
Model API resource controller
php artisan make:controller CustomerController --resource --model=Customer --api
Nested resource controller
php artisan make:controller CityController --resource --parent=Country --model=City
Nested API resource controller
php artisan make:controller CityController --resource --parent=Country --model=City --api
Variables
In the stubs you can use the following variables.
General
| Variable | Output |
|---|---|
| {{ namespace }} | App\Http\Controllers |
| {{ namespacedModel }} | App\Models\Order |
| {{ class }} | OrderController |
| {{ model }} | Order |
| {{ modelVariable }} | order |
| {{ modelVariablePlural }} | orders |
With parent (--parent=Customer)
| Variable | Output |
|---|---|
| {{ namespacedParentModel }} | App\Models\Customer |
| {{ parentModelVariable }} | customer |
| {{ parentModelVariablePlural }} | customers |
More generator packages
Looking for more ways to speed up your workflow? Make sure to check out these packages.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
The MIT License (MIT). Please see License File for more information.
timwassenburg/laravel-improved-resource-controllers 适用场景与选型建议
timwassenburg/laravel-improved-resource-controllers 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 114 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 10 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「php」 「controllers」 「cli」 「crud」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timwassenburg/laravel-improved-resource-controllers 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timwassenburg/laravel-improved-resource-controllers 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timwassenburg/laravel-improved-resource-controllers 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Opinionated Laravel Controllers extension
A package for generating annotations and drawing SwUi when working with Bitrix controllers.
Bullet development for Laravel Applications
Bundle of annotations to make it easier and faster to develop Rest APIs with Symfony.
Div PHP Ways
统计信息
- 总下载量: 114
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-25
