Swisnl Json Api Client Versions Save

A PHP package for mapping remote {json:api} resources to Eloquent like models and collections.

1.0.0-beta

4 years ago

Changed

  • Drop art4/json-api-client dependency and validate the JSON ourselves #58.
  • \Swis\JsonApi\Client\Exceptions\ValidationException is thrown instead of \Art4\JsonApiClient\Exception\ValidationException #58.
  • Added hasAttribute to ItemInterface.
  • All exceptions thrown by this package now implement \Swis\JsonApi\Client\Exceptions\Exception.

Fixed

  • Empty (null) links are correctly parsed.
  • Empty (null) singular relationships are correctly parsed.

0.20.0

4 years ago

Changed

  • Changed signature of RepositoryInterface::save(). It should now receive an ItemInterface instead of a ItemDocumentInterface #55. N.B. This is a breaking change!

0.19.0

4 years ago

This is a big release to improve the overall code quality and align some inconsistencies. Please note it includes several breaking changes so read through all changes carefully when upgrading!

Added

  • Added DocumentFactory #52.
  • Added facades for DocumentFactory, DocumentParser, ItemHydrator, ResponseParser and TypeMapper.
  • Added DocumentParserInterface and ResponseParserInterface interfaces and implementations #54.

Changed

  • The TypeMapper now checks if the class exists in the setter instead of the getter.
  • The ItemHydrator now also hydrates the id if provided #53.
  • Added hasType, hasAttributes, hasRelationships and getRelations to ItemInterface #53.
  • Removed canBeIncluded and getIncluded from ItemInterface as the DocumentFactory is now responsible for gathering the included items #53.
  • Renamed getRelationship to getRelation, hasRelationship to hasRelation and removeRelationship to unsetRelation in Item #53.
  • Renamed/aligned some parameters in several relation methods in Item #53.
  • Renamed namespace Swis\JsonApi\Client\Traits to Swis\JsonApi\Client\Concerns #53.
  • Renamed namespace Swis\JsonApi\Client\JsonApi to Swis\JsonApi\Client\Parsers #54.
  • Renamed ServiceProvider::registerParser (singular) to ServiceProvider::registerParsers (plural) #54.

Removed

  • Removed CollectionDocumentBuilder and ItemDocumentBuilder in favor of DocumentFactory #52.
  • Removed ParserInterface in favor of DocumentParserInterface and ResponseParserInterface #54.

0.18.0

4 years ago

This release includes changes to some interfaces. This is a breaking change if you use these interfaces in your own code.

Added

  • The id of an item can be set/get using magic accessors just like the attributes #51.

Changed

  • Added (optional) type hints to several interfaces. N.B. This is a breaking change if you implement some of the interfaces yourself. Please look at the interfaces and make the appropriate changes in your implementation.
  • Renamed deleteById method to simply delete and removed the 'old' implementation in RepositoryInterface. N.B. This is a breaking change and all calls to deleteById should simply be changed to delete as the signature is unchanged. The old behaviour of delete is not supported any more.

0.17.0

5 years ago

Added

  • Added support for Laravel 5.8 #50.

Changed

  • Dropped Laravel <5.5 support #50.
  • Dropped PHP <7.1 support #50.

0.16.0

5 years ago

Added

  • Added DocumentInterface::getResponse() so every document instance can have its corresponding response. This allows access to the underlying response to check headers or status codes etc #48.
  • Added ParserInterface::deserializeResponse($reponse) to deserialize a \Psr\Http\Message\ResponseInterface.

Changed

  • ClientInterface must now return a \Psr\Http\Message\ResponseInterface for requests instead of our own (removed) ResponseInterface #48. N.B. This is a breaking change if you use the Client directly, the DocumentClient isn't affected.
  • Changed namespace of error classes:
\Swis\JsonApi\Client\Errors\Error -> \Swis\JsonApi\Client\Error
\Swis\JsonApi\Client\Errors\ErrorCollection -> \Swis\JsonApi\Client\ErrorCollection
\Swis\JsonApi\Client\Errors\ErrorSource -> \Swis\JsonApi\Client\ErrorSource

Removed

  • Removed ResponseInterface and Response classes #48.

0.15.0

5 years ago

This release includes changes to some interfaces #47. This is a breaking change if you use these interfaces in your own code.

Added

  • Added take method to Repository to allow fetching resources without id.
  • Added links and meta to ItemInterface.
  • Added Jsonapi class.
  • Added links and meta to OneRelationInterface and ManyRelationInterface.
  • Added Link and Links classes.
  • Added links to Error.

Changed

  • Error::getMeta() now returns a Meta instance instead of an ErrorMeta instance. The Meta class does not have the has and get methods, but uses magic overloading methods (e.g. __get and __set) just like Item. N.B. This is a breaking change if you use meta on errors.
  • DocumentInterface::getLinks() now returns a Links instance instead of a plain array. If no links are present, it returns null. All implementations have been updated to reflect these changes. N.B. This is a minor breaking change if you use links on documents.
  • DocumentInterface::getMeta() now returns a Meta instance instead of a plain array. If no meta is present, it returns null. All implementations have been updated to reflect these changes. N.B. This is a minor breaking change if you use meta on documents.
  • DocumentInterface::getJsonapi() now returns a Jsonapi instance instead of a plain array. If no jsonapi is present, it returns null. All implementations have been updated to reflect these changes.
  • Parameters for ItemInterface::setRelation() have changed to include optional Links and Meta objects.
  • JsonApi\ErrorsParser, JsonApi\Hydrator and JsonApi\Parser have an extra dependency in their constructor. N.B. Make sure to add this dependency if you've overwritten ServiceProvider::registerParser or construct the JsonApi\Parser yourself.

Removed

  • Removed ErrorMeta class in favor of generic Meta class.

Fixed

0.14.0

5 years ago

This release includes changes to some interfaces #45. This is a breaking change if you use these interfaces in your own code.

Added

  • Added OneRelationInterface and ManyRelationInterface to differentiate between singular and plural relations.
  • Added documentation about ItemDocumentBuilder, ItemHydrator and Repository classes.

Changed

  • Moved setType and getType from RelationInterface to a separate interface; TypedRelationInterface.
  • Added type hints to ItemInterface::setRelation.
  • Added return type hint to Item::hasAttribute.

Removed

  • Removed RelationInterface in favor of OneRelationInterface and ManyRelationInterface.
  • Removed setId and getId from HasOneRelation and MorphToRelation. These operations should be performed on the included item.
  • Removed setType and getType from morph relations. Use regular relations if you want to set the type.

0.13.0

5 years ago

Fixed

  • Omit item from included when it has no attributes or relationships (only type and id) N.B. This is a breaking change if you implement the ItemInterface yourself instead of using the supplied Item.
  • Make sure included is always a plain array so it is serialized as array

0.12.1

5 years ago

Fixed

  • Fix hydrating of HasOne relations by id using ItemHydrator #44