laravel-json-api/laravel
Composer 安装命令:
composer require laravel-json-api/laravel
包简介
JSON:API for Laravel applications.
README 文档
README
JSON:API for Web Artisans
Implement feature-rich JSON:API compliant APIs in your Laravel applications. Build your next standards-compliant API today.
Why use JSON:API and Laravel JSON:API?
Great question! Here's some reasons from this excellent article by Denisa Halmaghi:
Why Use JSON:API?
- Standardised, consistent APIs.
- Feature rich - some of which are: sparse fieldsets (only fetch the fields you need), filtering, sorting, pagination, eager loading for relationships (includes, which solve the N+1 problem).
- Easy to understand.
Why use Laravel JSON:API?
- Saves a lot of development time.
- Highly maintainable code.
- Great, extensive documentation.
- Strong conventions, but also highly customisable.
- Makes use of native Laravel features such as policies and form requests to make the shift easier for developers.
- Beautiful, expressive Nova-style schemas.
- Fully testable via expressive test helpers.
class PostSchema extends Schema { /** * The model the schema corresponds to. * * @var string */ public static string $model = Post::class; /** * The maximum include path depth. * * @var int */ protected int $maxDepth = 3; /** * Get the resource fields. * * @return array */ public function fields(): array { return [ ID::make(), BelongsTo::make('author')->type('users')->readOnly(), HasMany::make('comments')->readOnly(), Str::make('content'), DateTime::make('createdAt')->sortable()->readOnly(), DateTime::make('publishedAt')->sortable(), Str::make('slug'), BelongsToMany::make('tags'), Str::make('title')->sortable(), DateTime::make('updatedAt')->sortable()->readOnly(), ]; } /** * Get the resource filters. * * @return array */ public function filters(): array { return [ WhereIdIn::make($this), WhereIn::make('author', 'author_id'), ]; } /** * Get the resource paginator. * * @return Paginator|null */ public function pagination(): ?Paginator { return PagePagination::make(); } }
Documentation
See our website, laraveljsonapi.io
Tutorial
New to JSON:API and/or Laravel JSON:API? Then the Laravel JSON:API tutorial is a great way to learn!
Follow the tutorial to build a blog application with a JSON:API compliant API.
Installation
Install using Composer
composer require laravel-json-api/laravel
See our documentation for further installation instructions.
Upgrading
When upgrading you typically want to upgrade this package and all our related packages. This is the recommended way:
composer require laravel-json-api/laravel --no-update
composer require laravel-json-api/testing --dev --no-update
composer up "laravel-json-api/*" cloudcreativity/json-api-testing
Example Application
To view an example Laravel application that uses this package, see the Tutorial Application.
License
Laravel JSON:API is open-sourced software licensed under the MIT License.
laravel-json-api/laravel 适用场景与选型建议
laravel-json-api/laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.53M 次下载、GitHub Stars 达 640, 最近一次更新时间为 2020 年 11 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「jsonapi」 「JSON-API」 「jsonapi.org」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laravel-json-api/laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laravel-json-api/laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravel-json-api/laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Serializer transformers outputting valid API responses in JSON, JSON API and HAL+JSON API formats.
Symfony 2 & 3 JSON API Transformer Package
PHP-code generator (based on OAS) for Laravel framework, with complete support of JSON-API data format
The jsonapi-querifier-bundle offers the Querifer filter syntax for the paknahad/jsonapi-bundle.
Laravel5 JSONAPI and Dingo together to build APIs fast
The jsonapi-bundle is a Symfony bundle. it is the fastest way to generate API based on JsonApi.org using woohoolabs/yin
统计信息
- 总下载量: 1.53M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 641
- 点击次数: 11
- 依赖项目数: 20
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-20