attus/jsonapi

This package is abandoned and no longer maintained. No replacement package was suggested.

JSON:API Formatter and Response

1.1 2022-03-02 10:18 UTC

This package is auto-updated.

Last update: 2022-03-02 10:19:33 UTC


README

No Maintenance Intended

Simple JSON:API Serialization package

use Attus\JsonApi\Entity;
use Attus\JsonApi\Response;

$entity = new Entity();
$entity->setId($myId);
$entity->setType($myType);
$entity->setLink(['self', 'href'], $myLink);

$entity->setAttribute($name, $value);
$entity->setRelationship($name, $myRelationship);

$data = $entity->getData();

return new Response($data);