asif160627/laravel-resources-generator
Composer 安装命令:
composer require asif160627/laravel-resources-generator
包简介
Generate Laravel Model,Migration,Service,Controller,Resources with single command
README 文档
README
Generate Laravel Model, Migration, Service, Controller, Resources with a single command.
Installation
You can install this package via Composer:
composer require asif160627/laravel-resources-generator
Usage
After installing the package, you can use the generate:resource command to generate the necessary files for a resource:
php artisan generate:resource {name} {--type=page|modal}
Replace {name} with the desired name of your resource. This command will generate a model, migration, service, controller, resource, and other related files.
Replace {name} with the desired name for your resource. The command will create the following files associated with the specified resource:
The generate:resource command creates the following files for a new resource:
- A model with the specified name.
- A migration file for the model's database table.
- A service class for managing the resource's business logic.
- A controller for handling HTTP requests and responses.
- A resource class for formatting the resource's data in API responses.
- A request class for validating input data.
Publishing Resources
This package supports resource publishing, allowing you to customize the generated files to fit your project's needs. To publish the package's resources, you can use the following command:
php artisan vendor:publish --provider="Asif160627\GenerateResources\ResourceServiceProvider"
This command will list the available resources for publishing. You can choose which resources you want to publish by selecting the associated numbers.
Example
For instance, if you want to generate the necessary files for a resource named "Product," you would execute the following command:
php artisan generate:resource Product
Subfolders
If you want to organize the generated files within a specific subfolder, you can specify the subfolder along with the resource name. For example, to create a Product resource within an Admin subfolder, use the following command:
php artisan generate:resource Admin/Product
The command will create the necessary files for the Product resource within the Admin subfolder.
Customizing Generated Files
The generate:resource command streamlines the process of generating common resource files. However, you can always modify and extend these files further to match your project's specific requirements.
Testing
To run the package tests, execute the following command:
php artisan test --filter GenerateResourcesCommandTest
This will run the tests for the generate:resource command and ensure its functionality.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This package is open-source software licensed under the MIT license.
asif160627/laravel-resources-generator 适用场景与选型建议
asif160627/laravel-resources-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 736 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「command」 「controller」 「migration」 「model」 「laravel」 「services」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 asif160627/laravel-resources-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 asif160627/laravel-resources-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 asif160627/laravel-resources-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Give your JS App some Backbone with Models, Views, Collections, and Events.
A Wrapper for exec and it's results
Symfony bundle to monitor and execute commands
Shell command module for PHP.
Library with classes to help you do batch.
Lets you add foreign keys in a swift! Foreign key adder in laravel migration.
统计信息
- 总下载量: 736
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-20