All notable changes to this project will be documented in this file, in reverse chronological order by release.
Versions prior to 0.4.0 were released as the package "weierophinney/hal".
- Nothing.
- #27 modifies
the
XmlRenderer
to raise an exception when attempting to render objects that are not serializable to strings.
- Nothing.
- Nothing.
- #27 adds
handling for
DateTime
and string serializable objects to theXmlRenderer
, allowing them to be rendered.
- #26 adds support for the zend-expressive-helpers 5.0 series of releases.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#23 modifies how the resource generator factory adds strategies and maps metadata to strategies. It now adds the following factories under the
Zend\Expressive\Hal\Metadata
namespace:RouteBasedCollectionMetadataFactory
RouteBasedResourceMetadataFactory
UrlBasedCollectionMetadataFactory
UrlBasedResourceMetadataFactory
Each implements a new
MetadataFactoryInterface
under that same namespace that accepts the requested metadata type name and associated metadata in order to create anAbstractMetadata
instance. Metadata types are mapped to their factories under thezend-expressive-hal.metadata-factories
key.Strategies are now configured as metadata => strategy class pairings under the
zend-expressive-hal.resource-generator.strategies
key.In both cases, defaults that mimic previous behavior are provided via the
ConfigProvider
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #21 fixes the
LinkGeneratorFactory
to properly use theZend\Expressive\Hal\LinkGenerator\UrlGeneratorInterface
service when creating and returning theLinkGenerator
instance. (0.5.0 was incorrectly attempting to use theUrlGenerator
service, which does not exist.)
- Nothing.
-
#20 renames the following interfaces and traits to have
Interface
andTrait
suffixes, respectively; this was done for consistency with existing ZF packages. (Values after the:
retain the namespace, which is omitted for brevity.)Zend\Expressive\Hal\LinkGenerator\UrlGenerator
:UrlGeneratorInterface
Zend\Expressive\Hal\Renderer\Renderer
:RendererInterface
Zend\Expressive\Hal\ResourceGenerator\Strategy
:StrategyInterface
Zend\Expressive\Hal\ResourceGenerator\ExtractCollection
:ExtractCollectionTrait
Zend\Expressive\Hal\ResourceGenerator\ExtractInstance
:ExtractInstanceTrait
-
#16 renames the various
Exception
interfaces toExceptionInterface
, in order to be consistent with other ZF packages.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#19 fixes the behavior of
ResourceGenerator
when nesting a collection inside another resource to properly nest it as an array of items, rather than a collection resource. -
#18 fixes the return type hint of
RouteBasedResourceMetadata::setRouteParams()
to correctly bevoid
. -
#13 updates
ExtractCollection::extractPaginator()
to validate that the pagination parameter is within the range of pages represented by the paginator instance; if not, anOutOfBoundsException
is raised. -
#12 fixes how pagination metadata (
_page
,_page_count
,_total_items
) is represented in generated resources, ensuring values are cast to integers.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
-
#7 fixes a number of issues in the various exception implementations due to failure to import classes referenced in typehints.
-
#6 fixes a number of docblock annotations to reference
HalResource
vsResource
(which is a reserved word).
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #6 fixes an issue with the XML renderer when creating resource elements that represent an array.
- Nothing.
- The package name was changed to "zendframework/zend-expressive-hal".
- The namespace was changed from
Hal
toZend\Expressive\Hal
.
- Nothing.
- Nothing.
- Nothing.
-
#4 adds the ability to force both links and embedded resources to be rendered as collections, even if the given relation only contains one item.
To force a link to be rendered as a collection, pass the attribute
__FORCE__COLLECTION__
with a boolean value oftrue
(or use the constantLink::AS_COLLECTION
to refer to the attribute name).To force an embedded resource to be rendered as a collection, pass a boolean
true
as the third argument toembed()
. Alternately, pass an array containing the single resource to any of the constructor,withElement()
, orembed()
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- #1 adds a
Hal\Renderer
subcomponent with the following:Renderer
interfaceJsonRenderer
, for creating JSON representations ofHalResource
instances.XmlRenderer
, for creating XML representations ofHalResource
instances.
-
#1 changes
Hal\HalResponseFactory
to compose aJsonRenderer
andXmlRenderer
, instead of composing$jsonFlags
and creating representations itself.It also makes the response prototype and the stream factory the first arguments, as those will be the values most often injected.
The constructor signature is now:
public function __construct( Psr\Http\Message\ResponseInterface $responsePrototype = null, callable $streamFactory = null, Hal\Renderer\JsonRenderer $jsonRenderer = null, Hal\Renderer\XmlRenderer $xmlRenderer = null ) {
-
#1 changes
Hal\HalResponseFactoryFactory
to comply with the new constructor signature ofHal\HalResponseFactory
. It also updates to check forPsr\Http\Message\ResponseInterface
andPsr\Http\Message\StreamInterface
services before attempting to use zend-diactoros classes.
- Nothing.
- Nothing.
- Nothing.
- Adds keywords to the
composer.json
- Adds a "provides" section to the
composer.json
(provides PSR-13 implementation) - Adds
composer.json
suggestions for:- PSR-11 implementation
- zend-paginator
- Nothing.
- Nothing.
- Nothing.
- Adds documentation; see the doc/book/ tree, or browse at https://weierophinney.github.io/hal/
- Nothing.
- Nothing.
- Nothing.
- Adds the method
templatedFromRoute()
to theLinkGenerator
class. Acts exactly likefromRoute()
, but the generatedLink
instance will have theisTemplated
property toggledtrue
.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Nothing.
- Fixes registration of the
MetadataMap
in theConfigProvider
; it was previously using an incorrect namespace.
- Adds
HalResponseFactoryFactory
, a factory for generating aHalResponseFactory
instance.
- Nothing.
- Nothing.
- Nothing.
-
Adds the ability to inject route params and query string arguments at run-time to the route-based metadata instances.
When dealing with route-based metadata, we may be dealing with sub-resources; in such cases, the route parameters may be derived from the request, and we will want to inject them at run-time.
When dealing with collections, the query string arguments may indicate things such as searches, sort directions, sort columns, filters, limits, etc.; these will be derived from the request, and need to be injected at run-time.
- Nothing.
- Nothing.
- Nothing.
Initial Release.
- Everything.
- Nothing.
- Nothing.
- Nothing.