ADDED:
- Support for PSR-18
CHANGED:
- Increased minimum PHP version requirement to 7.4
- Declare nearly all property types
- #34:
JsonApiClientimplements PSR-18'sClientInterface - #33: Use
Psr\Http\Client\ClientInterfaceas type
REMOVED:
- Support for php-http/httplug v1
- The deprecated ClassHydrator
- The deprecated HydratorInterface
CHANGED:
- #33: Use
Psr\Http\Client\ClientInterfaceas type - Declare nearly all property types
REMOVED:
- Support for php-http/httplug v1
ADDED:
- #34:
JsonApiClientimplements PSR-18'sClientInterface
CHANGED:
- Increased minimum PHP version requirement to 7.4
- PSR-18 is used instead of HTTPlug
REMOVED:
- The deprecated ClassHydrator has been removed
- The deprecated HydratorInterface has been removed
ADDED:
- #31: Allow to set the
filterquery parameter directly
ADDED:
- Support for PHP 8
- Support for PHPUnit 9
CHANGED:
- #28: Introduce
AttributeHydratorInterface
FIXED:
ClassDocumentHydrator::hydrateSingleResource()returns anobjectinstead ofstdClass
ADDED:
AbstractClassDocumentHydratoras a base class for custom hydrators
CHANGED:
- Increased minimum PHP version requirement to 7.2
ClassDocumentHydratoris no longer afinalclass
ADDED:
- #13:
DocumentHydratorInterfaceandClassDocumentHydratorin order to fix some issues with theHydratorInterfaceandClassHydrator - #15: New accessor and mutator methods for
WoohooLabs\Yang\JsonApi\Request\ResourceObject:id(),setId(),type(),setType(),attributes(),relationships()
DEPRECATED:
HydratorInterface: use theDocumentHydratorInterfaceinsteadClassHydrator: use theClassDocumentHydratorinstead
CHANGED:
- Apply the Woohoo Labs. Coding Standard
ADDED:
- JSON:API 1.1 related features:
- Support for Profiles
- Support for
typelinks in errors
Document::errorCount()to easily count errors in the document- Support for defining a default value when using the
ResourceObject::attribute()method
CHANGED:
- Improve type-safety by eliminating
nullreturn values (BREAKING CHANGE):JsonApiResponse::document()throws an exception instead of returning null if the response doesn't contain a document.Document::primaryResources()throws an exception if the document is a single-resource or error documentDocument::primaryResource()throws an exception if the document is a collection or error document or the primary resource is missingDocument::resource()throws an exception instead of returning null if the requested resource is missingDocument::error()throws an exception instead of returning null if the document does not contain the requested errorRelationship::resources()throws an exception instead of returning an empty array if the relationship is a to-oneRelationship::resource()throws an exception instead of returning null if the relationship is a to-many or emptyRelationship::resourceBy()throws an exception instead of returning null if the requested resource is missingResourceObject::relationship()throws an exception instead of returning null if the requested relationship is missing
- Move errors, links, and resources to their own namespace (BREAKING CHANGE):
WoohooLabs\Yang\JsonApi\Schema\ErrortoWoohooLabs\Yang\JsonApi\Schema\Error\ErrorWoohooLabs\Yang\JsonApi\Schema\ErrorSourcetoWoohooLabs\Yang\JsonApi\Schema\Error\ErrorSourceWoohooLabs\Yang\JsonApi\Schema\LinktoWoohooLabs\Yang\JsonApi\Schema\Link\LinkWoohooLabs\Yang\JsonApi\Schema\ResourceObjectstoWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObjectsWoohooLabs\Yang\JsonApi\Schema\ResourceObjecttoWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject
- Return separate classes instead of a general
Linksfor the different types of links (BREAKING CHANGE):DocumentLinkswhen usingDocument::links()ResourceLinkswhen usingResourceObject::links()RelationshipLinkswhen usingRelationship::links()ErrorLinkswhen usingError::links()
JsonSerializer::serialize()will throw aRequestExceptioninstead ofLogicExceptionif the body is of invalid type (BREAKING CHANGE)- Rename
JsonApitoJsonApiObject(BREAKING CHANGE) - Apply the Woohoo Labs. Coding Standard
REMOVED:
- The generic
Linkclass (BREAKING CHANGE)
FIXED:
- Issues with 0 when converting to array
ADDED:
- JSON:API 1.1 related features:
- Support for Profiles
- Support for
typelinks in errors
Document::errorCount()to easily count errors in the document- Support for defining a default value when using the
ResourceObject::attribute()method
CHANGED:
- Improve type-safety by eliminating
nullreturn values (BREAKING CHANGE):JsonApiResponse::document()throws an exception instead of returning null if the response doesn't contain a documentDocument::primaryResources()throws an exception if the document is a single-resource or error documentDocument::primaryResource()throws an exception if the document is a collection or error document or the primary resource is missingDocument::resource()throws an exception instead of returning null if the requested resource is missingDocument::error()throws an exception instead of returning null if the document does not contain the requested errorRelationship::resources()throws an exception instead of returning an empty array if the relationship is a to-oneRelationship::resource()throws an exception instead of returning null if the relationship is a to-many or emptyRelationship::resourceBy()throws an exception instead of returning null if the requested resource is missingResourceObject::relationship()throws an exception instead of returning null if the requested relationship is missing
- Move errors, links, and resources to their own namespace (BREAKING CHANGE):
WoohooLabs\Yang\JsonApi\Schema\ErrortoWoohooLabs\Yang\JsonApi\Schema\Error\ErrorWoohooLabs\Yang\JsonApi\Schema\ErrorSourcetoWoohooLabs\Yang\JsonApi\Schema\Error\ErrorSourceWoohooLabs\Yang\JsonApi\Schema\LinktoWoohooLabs\Yang\JsonApi\Schema\Link\LinkWoohooLabs\Yang\JsonApi\Schema\ResourceObjectstoWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObjectsWoohooLabs\Yang\JsonApi\Schema\ResourceObjecttoWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject
- Return separate classes instead of a general
Linksfor the different types of links (BREAKING CHANGE):DocumentLinkswhen usingDocument::links()ResourceLinkswhen usingResourceObject::links()RelationshipLinkswhen usingRelationship::links()ErrorLinkswhen usingError::links()
JsonSerializer::serialize()will throw aRequestExceptioninstead ofLogicExceptionif the body is of invalid type (BREAKING CHANGE)- Rename
JsonApitoJsonApiObject(BREAKING CHANGE)
REMOVED:
- The generic
Linkclass (BREAKING CHANGE)
FIXED:
- Issues with 0 when converting to array
ADDED:
- Support for PSR-18 and HTTPlug 2.0
CHANGED:
- Update PHPUnit to 7.0
ADDED:
ClassHydrator::hydrateObject()method
ADDED:
- Support for hydrating collections via
HydratorInterface::hydrateCollection()
FIXED:
- #9: Resources with an ID of "0" disappear when using
ClassHydrator - Other issues with "0" affecting
ResourceObject::toString()andJsonApiRequestBuilder::toString()
FIXED:
- #8: Fix for unexpected behaviour when To-One relationship data is null
CHANGED:
- Increased minimum PHP version requirement to 7.1
ADDED:
- Ability to hydrate responses to objects via
ClassHydrator - Ability to retrieve all relationships of a resource via
ResourceObject::getRelationships()
ADDED:
- #4: Allow relationship's resource identifier objects to have a "meta" value
CHANGED:
ToManyRelationship::addResourceIdentifier()uses fluent interface- Added missing parameter type declarations
ADDED:
ResourceObject::idAndAttributes()method
ADDED:
- Support for custom serialization
- Ability to configure the
JsonDeserializer
CHANGED:
- Increased minimum PHP version requirement to 7.0
- Renamed
DefaultDeserializertoJsonDeserializer - Moved
JsonApiClientandJsonApiAsyncClientinto theJsonApi\Clientnamespace - Moved deserializers into the
JsonApi\Serializernamespace along with serializers
ADDED:
- Better support for "about" links
CHANGED:
Error::createFromArray()performs more type checks before instantiating anErrorobject- Renamed
ErrorSource::fromArray()toErrorSource::createFromArray() ErrorSource::createFromArray()performs more type checks before instantiating anErrorSourceobject- Added
Relationships::createFromArray()instead of the constructor - Renamed
Relationship::resourceLinktoRelationship::firstResourceLink
FIXED:
- Representing error status as string as per the spec
CHANGED:
Link::createFromArray()performs type checks before instantiating aLinkobject- Added
ResourceObject::createFromArray()instead of the constructor ResourceObject::createFromArray()performs more type checks before instantiating aResourceObject- The "jsonapi" member is always present when using
Document::toArray() - The "links" member won't be present in a relationship when it is empty when using
ResourceObject::toArray()
REMOVED:
Links::hasLinks()methodJsonApi::hasJsonApi()method
FIXED:
- The "jsonapi" member was incorrectly recognized as "jsonApi"
- If the "jsonapi" member doesn't define the
version, "1.0" will be the default now as per the spec - Invocation of
Links::hasLink()and thusLinks::hasSelf()etc. methods resulted in an infinite loop Relationship::toArray()showed the "data" member incorrectly for to-one relationships
ADDED:
JsonApiResource::setRelationship()method- Unit tests
- Docker support to run tests
Links::hasAnyLinks()method
CHANGED:
- Added
JsonApiResource::setToOneRelationship()instead ofJsonApiResource::setToOneResourceIdentifier() - Added
JsonApiResource::setToManyRelationship()instead ofJsonApiResource::addToManyResourceIdentifier() - The "links" member won't be present in the "data" member when it is empty when using
Document::toArray() - Renamed several methods of
ResourceObjects(removedgetprefixes) - Renamed
JsonApiRelationshipInterfaceclass toRelationshipInterface - Renamed
JsonApiResourceclass toResourceObject - Renamed
JsonApiToManyRelationshipclass toToManyRelationship - Renamed
JsonApiToOneRelationshipclass toToOneRelationship
FIXED:
JsonApiResourcedidn't add relationships to the request- The
typeconstructor argument became required forJsonApiResource JsonApiRequestBuilder::setPort()didn't do anythingJsonApiRequestBuilder::setJsonApi*()methods didn't work as intendedJsonApiRequestBuilder::update()will now set the request method to "PATCH" instead of "UPDATE"- Error objects are correctly listed under the "errors" member when using
Document::toArray() - Correctly transforming "included" member when using
Document::toArray() ResourceObjects::isSingleResourceDocument()Document::isResourceDocument()returned wrong value when "data" member was nullResourceObjects::hasAnyPrimaryResources()returned wrong value when "data" member was null
CHANGED:
- Renamed
JsonApiAsyncClient::requestConcurrent()toJsonApiAsyncClient::sendConcurrentAsyncRequests() - Renamed
Document::hasPrimaryResources()toDocment::hasAnyPrimaryResources() - Renamed
Document::hasIncludedResources()toDocment::hasAnyIncludedResources() - Renamed almost all methods in
JsonApiRequestBuilder - Do not sort included resources by type and id
- Improved documentation
ADDED:
- Support for custom deserialization
CHANGED:
- Updated minimum PHP version requirement to 5.6
- Renamed
ResourcetoResourceObjectandResourcestoResourceObjects
ADDED:
- Support for HTTPlug library to abstract the HTTP client away
JsonApiResource::setAttributes()method
CHANGED:
- Moved asyncronous functionalities of
JsonApiClientintoJsonApiAsyncClient JsonApiClient::request()method was renamed toJsonApiClient::sendRequest()JsonApiAsyncClient::requestAsync()method was renamed toJsonApiAsyncClient::sendAsyncRequest()
FIXED:
- Error when serialized response body is apparently empty even though it contains data
ADDED:
- Ability to define options for
JsonApiClient Document::error($number)utility method to retrieve only one errorResponse::isSuccessful()to determine if the response was successfulResponse::isSuccessfulDocument()to determine if the response was successful and contains a document- Support for PHPUnit 5.0
CHANGED:
- Improved performance
FIXED:
- PHP version constraint in composer.json
- If the response didn't contain a valid JSON,
Response::document()could have raised a fatal error - The type and id weren't included in the request body
- Empty responses weren't considered successful by
JsonApiResponse::isSuccessful() - Empty relationship data can now be discovered
- Sorting does not happen on resource ID
ADDED:
- Ability to send multiple async requests concurrently
- Ability to determine the type of documents and relationships
CHANGED:
- Shortened getter names (removed the "get" prefix)
- Initial release