PHPackages                             hyperf-ext/json-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hyperf-ext/json-api

ActiveLibrary[API Development](/categories/api)

hyperf-ext/json-api
===================

JSON API (jsonapi.org) support for Hyperf applications.

v2.2.0(4y ago)115Apache-2.0PHPPHP ^7.4

Since Jul 30Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hyperf-ext/json-api)[ Packagist](https://packagist.org/packages/hyperf-ext/json-api)[ Docs](https://github.com/hyperf-ext/json-api)[ RSS](/packages/hyperf-ext-json-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (26)Versions (2)Used By (0)

Hyperf {JSON:API} 组件
====================

[](#hyperf-jsonapi-组件)

Build feature-rich and standards-compliant APIs in Hyperf.

> This package is ported from [cloudcreativity/laravel-json-api](https://github.com/cloudcreativity/laravel-json-api).

This package provides all the capabilities you need to add [JSON API](http://jsonapi.org)compliant APIs to your application. Extensive support for the specification, including:

- Fetching resources
- Fetching relationships
- Inclusion of related resources (compound documents)
- Sparse fieldsets.
- Sorting.
- Pagination.
- Filtering
- Creating resources.
- Updating resources.
- Updating relationships.
- Deleting resources.
- Validation of:
    - JSON API documents; and
    - Query parameters.

The following additional features are also supported:

- Full support for Hyperf model resources, with features such as:
    - Automatic eager loading when including related resources.
    - Easy relationship end-points.
    - Soft-deleting and restoring model resources.
    - Page and cursor based pagination.
- Asynchronous processing.
- Support multiple media-types within your API.
- Generators for all the classes you need to add a resource to your API.

### What is JSON API?

[](#what-is-json-api)

From [jsonapi.org](http://jsonapi.org)

> If you've ever argued with your team about the way your JSON responses should be formatted, JSON API is your anti-bikeshedding weapon.
>
> By following shared conventions, you can increase productivity, take advantage of generalized tooling, and focus on what matters: your application. Clients built around JSON API are able to take advantage of its features around efficiently caching responses, sometimes eliminating network requests entirely.

For full information on the spec, plus examples, see .

Documentation
-------------

[](#documentation)

@todo

License
-------

[](#license)

Apache License (Version 2.0). Please see [License File](LICENSE) for more information.

Installation
------------

[](#installation)

```
composer require hyperf-ext/json-api
```

Configuration
-------------

[](#configuration)

Publish configuration file:

```
php bin/hyperf.php vendor:publish hyperf-ext/json-api
```

The default configuration:

```
