tallieutallieu/dry-internal-api
最新稳定版本:3.0.2
Composer 安装命令:
composer require tallieutallieu/dry-internal-api
包简介
An internal API for your DRY applications
README 文档
README
An internal API for your DRY applications
Installation
composer require tallieutallieu/dry-internal-api
Example usage
Route definition
<?php use Tnt\InternalApi\Facade\Api; Api::get('posts/', '\\Acme\\Controller\\PostController::index'); Api::post('posts/', '\\Acme\\Controller\\PostController::add'); Api::delete('posts/(?<postId>\d+)/', '\\Acme\\Controller\\PostController::delete');
Controller
<?php namespace Acme\Controller; use Tnt\InternalApi\Exception\ApiException; use Tnt\InternalApi\Http\Request; class PostController { public static function index(Request $request) { return [ [ 'id' => 1, 'title' => 'My example post', ], [ 'id' => 2, 'title' => 'Another example post', ], ]; } public static function add(Request $request) { // Create your post } public static function delete(Request $request) { if ($request->data->integer('postId')) { // Delete your post return true; } throw new ApiException('post_not_found'); } }
统计信息
- 总下载量: 372
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2021-03-24