saeed/custom-api
Composer 安装命令:
composer require saeed/custom-api
包简介
Package for make restfull api project
README 文档
README
To install and set up the Saeed Custom API package, please follow the steps below:
Step 1: Install the Package
You can install the package using Composer with the following command:
composer require saeed/custom-api:dev-main
Step 2: Autoload Configuration
In your composer.json file, under the autoload section, add the following entry for PSR-4 autoloading:
"autoload": { "psr-4": { //... "Saeed\\CustomApi\\": "packages/saeed/customApi/src/" } }
Run the following command to update the autoloader:
composer dump-autoload
Step 3: Service Provider Registration
Next, you need to register the service provider in your application's configuration. Open the config/app.php file and add the provider to the providers array:
'providers' => [ // Other service providers... \Saeed\CustomApi\CustomApiServiceProvider::class, ],
Step 4: Creating Form Requests and Services
You can create form requests and logical services using the following Artisan commands:
Create API Request
To create a form request, run:
php artisan make:apiRequest {name}
Create Logic Service
To create a logic service, use:
php artisan make:apiService {name}
Step 5: Controller Setup
In your controller, you can inject the service as follows:
public function __construct(private Name $name) {}
Step 6: Using the Logic Service
You can use the logic service like this:
$result = $this->testService->showTests();
Step 7: Using the API Response
To format your API response, use the following code:
return ApiResponse::withMessage('Your message here') ->withData(TestResource::collection($result->data)) ->build() ->apiResponse();
Conclusion
These instructions should help you get started with the Saeed Custom API package. If you have any questions or issues, feel free to reach out for support!
saeed/custom-api 适用场景与选型建议
saeed/custom-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 95 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 saeed/custom-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 saeed/custom-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 95
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2025-01-13