codemonster-ru/api-resource
最新稳定版本:v1.0.0
Composer 安装命令:
composer require codemonster-ru/api-resource
包简介
JSON API resource and pagination primitives for Annabel applications.
关键字:
README 文档
README
JSON resource and simple pagination primitives for Annabel applications.
use Codemonster\ApiResource\JsonResource; final class UserResource extends JsonResource { public function toArray(): array { return [ 'id' => $this->resource->getKey(), 'name' => $this->resource->name, ]; } } return (new UserResource($user))->response();
Collections and existing database pagination results use the same resource:
return UserResource::collection(User::all())->response(); return UserResource::paginated( User::query()->simplePaginate(20, $page), '/api/users', ['filter' => 'active'], )->response();
Paginated responses contain data, links.prev, links.next, and
meta.current_page / meta.per_page.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-10