PHPackages                             attus/jsonapi\_response - 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. attus/jsonapi\_response

ActiveDrupal-module[API Development](/categories/api)

attus/jsonapi\_response
=======================

JSON:API Response based on Custom Data

2.7.0(2mo ago)02.4k↓25%GPL-3.0-or-laterPHP

Since Apr 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/attus74/jsonapi_response)[ Packagist](https://packagist.org/packages/attus/jsonapi_response)[ Docs](https://github.com/attus74/jsonapi_response)[ RSS](/packages/attus-jsonapi-response/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

JSON:API Response
=================

[](#jsonapi-response)

A Drupal 10 module for custom JSON:API Entity responses.

[![Maintenance](https://camo.githubusercontent.com/5ca62441414bacaa54c6c6e5b68e46c76305947b6bf498c4949fc71c1b4b10dd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d61696e7461696e65642533462d7965732d677265656e2e737667)](https://GitHub.com/attus74/jsonapi_response/graphs/commit-activity)[![GitHub license](https://camo.githubusercontent.com/5ad25270fd5846a07376efdcd1e29cc3185bab0870e4babe50b77ce895eb48a8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f617474757337342f6a736f6e6170695f726573706f6e73652e737667)](https://github.com/attus74/jsonapi_response/blob/master/LICENSE)[![GitHub release](https://camo.githubusercontent.com/6d2a9029f10f133303323bf5a09bcbbcb73688484d13d1bdee2798b4b89294fb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f617474757337342f6a736f6e6170695f726573706f6e73652e737667)](https://GitHub.com/attus74/jsonapi_response/releases/)[![GitHub issues](https://camo.githubusercontent.com/52ab3ab8479d8828fb2bb003b522f8db8127be71049f9897f0522dbff579e9fc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f617474757337342f6a736f6e6170695f726573706f6e73652e737667)](https://GitHub.com/attus74/jsonapi_response/issues/)

Usage
-----

[](#usage)

```
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\jsonapi_response\JsonapiEntityResponseInterface;

class MyController extends ControllerBase {

  private     $_jsonapiResponseEntity;

  public function __construct(JsonapiEntityResponseInterface $jsonapiResponseEntity) {
    $this->_jsonapiResponseEntity = $jsonapiResponseEntity;
  }

  public static function create(ContainerInterface $container) {
    return new static(
      $container->get('jsonapi_response.entity'),
    );
  }

  /**
   * A single entity in JSON:API Format
   */
  public function getMyEntity(): CacheableResponseInterface
  {
    $entity = $this->getEntityForResponse();
    $response = $this->_jsonapiResponseEntity->entityIndividualResponse($entity);
    $cache = new CacheableMetadata();
    $cache->setCacheMaxAge(0);
    $response->addCacheableDependency($cache);
    return $response;
  }

  /**
   * An entity collection in JSON:API Format
   */
  public function getMyEntityCollection(): CacheableResponseInterface
  {
    $entities = $this->getEntitiesForResponse();
    return $this->_jsonapiResponseEntity->entityCollectionResponse($entities);
  }

  /**
   * An entity collection in JSON:API Format with includes
   */
  public function getMyEntityCollectionWithIncludes(): CacheableResponseInterface
  {
    $entities = $this->getEntitiesForResponse();
    return $this->_jsonapiResponseEntity->entityCollectionResponse($entities, [$fieldName1, $fieldName2]);
  }

}
```

You are free to use this module without any restriction but without any warranty.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance85

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~126 days

Recently: every ~230 days

Total

15

Last Release

78d ago

Major Versions

1.2.1 → 2.0.02021-06-07

1.2.2 → 2.12022-01-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/963df7e1e6fed4dc987c99562b477720bb634c7ce47d0528ccf6e94e9cfea9f8?d=identicon)[attus74](/maintainers/attus74)

---

Top Contributors

[![attus74](https://avatars.githubusercontent.com/u/33147484?v=4)](https://github.com/attus74 "attus74 (8 commits)")

---

Tags

drupalentityJSON-API

### Embed Badge

![Health badge](/badges/attus-jsonapi-response/health.svg)

```
[![Health](https://phpackages.com/badges/attus-jsonapi-response/health.svg)](https://phpackages.com/packages/attus-jsonapi-response)
```

###  Alternatives

[neomerx/json-api

Framework agnostic JSON API (jsonapi.org) implementation

7373.6M27](/packages/neomerx-json-api)[cloudcreativity/laravel-json-api

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

7881.1M5](/packages/cloudcreativity-laravel-json-api)[laravel-json-api/laravel

JSON:API for Laravel applications.

6371.4M15](/packages/laravel-json-api-laravel)[timacdonald/json-api

A Lightweight JSON:API Resource for Laravel

639892.5k2](/packages/timacdonald-json-api)[art4/json-api-client

JSON API client

139791.3k7](/packages/art4-json-api-client)[friendsofcake/crud-json-api

Listener for building CakePHP Crud APIs following the JSON API specification.

58445.4k3](/packages/friendsofcake-crud-json-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
