graphicode/standard
最新稳定版本:v3.1
Composer 安装命令:
composer require graphicode/standard
包简介
the standard utlities for graphicode laravel team
README 文档
README
---
requirements
- php >=8.0
- laravel framework >=10.10
----
installation
Use this command to try the package now:
composer require graphicode/standard v3.0
publish lang files:
php artisan vendor:publish --tag="gcstandard-lang"
---
ApiResponse Trait
this trait used to make cleen api responses.
preparing your controller to use the trait:
<?php namespace App\Http\Controllers; use Graphicode\Standard\Traits\ApiResponses; class TestController extends Controller { use ApiResponses; public function index() { return $this->okResponse(data: [], message: "hello, api"); } }
Available methods:
/** * 200 Ok response * * @param $data * @param $message **/ return $this->okResponse(data: "data", message: "message"); /** * 201 resource created * * @param $data * @param $message **/ return $this->createdResponse(data: "data", message: "message"); /** * 400 bad response * * @param $data * @param $message **/ return $this->badResponse(data: "data", message: "message"); /** * 201 unauthorized * * @param $data * @param $message **/ return $this->unauthenticatedResponse(data: "data", message: "message");
统计信息
- 总下载量: 154
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-05