coding-partners/auto-controller
Composer 安装命令:
composer require coding-partners/auto-controller
包简介
The "Auto Controller" package for Laravel allows you to quickly generate fully functional controllers for any model in your application. With a single command, the package will create a controller with all the standard CRUD (Create, Read, Update, Delete) methods, saving you significant time and effo
README 文档
README
Description
coding-partners/auto-controller is a Laravel package allows you to quickly create fully functional controllers for any model in your project. With a single command, the package will create a console with all standard CRUD methods (create, read, update, delete) as well as soft-delete methods, saving you a lot of time and effort. This enables you to focus on building the core features of your project. And let's not forget its support for uploading all types of files with high security
Installation
To install the package, use the following command via Composer:
composer require coding-partners/auto-controller
Requirements
- PHP version 8.0 or higher is required.
Usage
To use the package: You must first set up the model and migration. For file fields:
- You must add the suffix
_imgto the image field. EX: image_img - You must add the suffix
_vidto the video field. EX: video_vid - You must add the suffix
_audto the audio field, EX: audio_aud - You must add the suffix
_docsto the document, EX: file_docs
public function up(): void { Schema::create('files', function (Blueprint $table) { $table->id(); $table->string('image_img'); $table->string('video_vid'); $table->string('audio_aud'); $table->string('file_docs'); $table->timestamps(); }); }
After ensuring that you have performed all the previous steps, you can run the following command via the Artisan Console:
php artisan crud:generate ModelName
Workflow:
- The command will generate
FormRequestclasses for the Store and Update operations. - It will then generate an API
Resourcefile for the model. - You will be prompted to choose whether to add a Service layer:
- If you answer
yes, a Service file specific to the controller will be generated, followed by the controller. - If you answer
no, only the controller will be generated.
- If you answer
- Finally, the necessary routes will be added to the
api.phpfile.
Example with Service
EUROPELAPTOP@DESKTOP-P3SVV3J MINGW64 /d/CRUD $ php artisan crud:generate Post Generating store FormRequest for Post... FormRequest StorePostRequest created successfully in folder PostRequest. Generating update FormRequest for Post... FormRequest UpdatePostRequest created successfully in folder PostRequest. Do you want to generate a Service for Post? (yes/no) [no]: > yes Generating Service for Post... Service PostService created successfully. Generating CRUD with service for Post... Controller PostController created successfully. Generating routes/api.php for Post... Post Route added successfully.
Example without Service
EUROPELAPTOP@DESKTOP-P3SVV3J MINGW64 /d/CRUD $ php artisan crud:generate User Generating store FormRequest for User... FormRequest StoreUserRequest created successfully in folder UserRequest. Generating update FormRequest for User... FormRequest UpdateUserRequest created successfully in folder UserRequest. Generating Resource for User... Resource UserResource created successfully. Do you want to generate a Service for User? (yes/no) [no]: > Generating CRUD without service for User... Controller UserController created successfully. Generating routes/api.php for User... User Route added successfully.
License
This package is licensed under the MIT License.
Contributions
Contributions are welcome! If you'd like to contribute to the development of this package, you can start by opening an Issue or submitting a Pull Request.
Authors
- YousefSaleh1
- Ayham-Ibrahim
coding-partners/auto-controller 适用场景与选型建议
coding-partners/auto-controller 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45 次下载、GitHub Stars 达 4, 最近一次更新时间为 2024 年 08 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 coding-partners/auto-controller 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 coding-partners/auto-controller 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 45
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-30