ADDED:
- Support for PSR-18
CHANGED:
- Increased minimum PHP version requirement to 7.4
- Declare nearly all property types
- #34:
JsonApiClient
implements PSR-18'sClientInterface
- #33: Use
Psr\Http\Client\ClientInterface
as type
REMOVED:
- Support for php-http/httplug v1
- The deprecated ClassHydrator
- The deprecated HydratorInterface
CHANGED:
- #33: Use
Psr\Http\Client\ClientInterface
as type - Declare nearly all property types
REMOVED:
- Support for php-http/httplug v1
ADDED:
- #34:
JsonApiClient
implements 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
filter
query parameter directly
ADDED:
- Support for PHP 8
- Support for PHPUnit 9
CHANGED:
- #28: Introduce
AttributeHydratorInterface
FIXED:
ClassDocumentHydrator::hydrateSingleResource()
returns anobject
instead ofstdClass
ADDED:
AbstractClassDocumentHydrator
as a base class for custom hydrators
CHANGED:
- Increased minimum PHP version requirement to 7.2
ClassDocumentHydrator
is no longer afinal
class
ADDED:
- #13:
DocumentHydratorInterface
andClassDocumentHydrator
in order to fix some issues with theHydratorInterface
andClassHydrator
- #15: New accessor and mutator methods for
WoohooLabs\Yang\JsonApi\Request\ResourceObject
:id()
,setId()
,type()
,setType()
,attributes()
,relationships()
DEPRECATED:
HydratorInterface
: use theDocumentHydratorInterface
insteadClassHydrator
: use theClassDocumentHydrator
instead
CHANGED:
- Apply the Woohoo Labs. Coding Standard
ADDED:
- JSON:API 1.1 related features:
- Support for Profiles
- Support for
type
links 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
null
return 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\Error
toWoohooLabs\Yang\JsonApi\Schema\Error\Error
WoohooLabs\Yang\JsonApi\Schema\ErrorSource
toWoohooLabs\Yang\JsonApi\Schema\Error\ErrorSource
WoohooLabs\Yang\JsonApi\Schema\Link
toWoohooLabs\Yang\JsonApi\Schema\Link\Link
WoohooLabs\Yang\JsonApi\Schema\ResourceObjects
toWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObjects
WoohooLabs\Yang\JsonApi\Schema\ResourceObject
toWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject
- Return separate classes instead of a general
Links
for the different types of links (BREAKING CHANGE):DocumentLinks
when usingDocument::links()
ResourceLinks
when usingResourceObject::links()
RelationshipLinks
when usingRelationship::links()
ErrorLinks
when usingError::links()
JsonSerializer::serialize()
will throw aRequestException
instead ofLogicException
if the body is of invalid type (BREAKING CHANGE)- Rename
JsonApi
toJsonApiObject
(BREAKING CHANGE) - Apply the Woohoo Labs. Coding Standard
REMOVED:
- The generic
Link
class (BREAKING CHANGE)
FIXED:
- Issues with 0 when converting to array
ADDED:
- JSON:API 1.1 related features:
- Support for Profiles
- Support for
type
links 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
null
return 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\Error
toWoohooLabs\Yang\JsonApi\Schema\Error\Error
WoohooLabs\Yang\JsonApi\Schema\ErrorSource
toWoohooLabs\Yang\JsonApi\Schema\Error\ErrorSource
WoohooLabs\Yang\JsonApi\Schema\Link
toWoohooLabs\Yang\JsonApi\Schema\Link\Link
WoohooLabs\Yang\JsonApi\Schema\ResourceObjects
toWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObjects
WoohooLabs\Yang\JsonApi\Schema\ResourceObject
toWoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject
- Return separate classes instead of a general
Links
for the different types of links (BREAKING CHANGE):DocumentLinks
when usingDocument::links()
ResourceLinks
when usingResourceObject::links()
RelationshipLinks
when usingRelationship::links()
ErrorLinks
when usingError::links()
JsonSerializer::serialize()
will throw aRequestException
instead ofLogicException
if the body is of invalid type (BREAKING CHANGE)- Rename
JsonApi
toJsonApiObject
(BREAKING CHANGE)
REMOVED:
- The generic
Link
class (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
DefaultDeserializer
toJsonDeserializer
- Moved
JsonApiClient
andJsonApiAsyncClient
into theJsonApi\Client
namespace - Moved deserializers into the
JsonApi\Serializer
namespace along with serializers
ADDED:
- Better support for "about" links
CHANGED:
Error::createFromArray()
performs more type checks before instantiating anError
object- Renamed
ErrorSource::fromArray()
toErrorSource::createFromArray()
ErrorSource::createFromArray()
performs more type checks before instantiating anErrorSource
object- Added
Relationships::createFromArray()
instead of the constructor - Renamed
Relationship::resourceLink
toRelationship::firstResourceLink
FIXED:
- Representing error status as string as per the spec
CHANGED:
Link::createFromArray()
performs type checks before instantiating aLink
object- 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
(removedget
prefixes) - Renamed
JsonApiRelationshipInterface
class toRelationshipInterface
- Renamed
JsonApiResource
class toResourceObject
- Renamed
JsonApiToManyRelationship
class toToManyRelationship
- Renamed
JsonApiToOneRelationship
class toToOneRelationship
FIXED:
JsonApiResource
didn't add relationships to the request- The
type
constructor 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
Resource
toResourceObject
andResources
toResourceObjects
ADDED:
- Support for HTTPlug library to abstract the HTTP client away
JsonApiResource::setAttributes()
method
CHANGED:
- Moved asyncronous functionalities of
JsonApiClient
intoJsonApiAsyncClient
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