attus / jsonapi

该软件包已弃用,不再维护。未建议替代软件包。

JSON:API 格式化器和响应

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

简单的 JSON:API 序列化软件包

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);