Provided factories

This component provides a number of factories for use with PSR-11, in order to generate fully configured instances for your use.

Zend\Expressive\Hal\HalResponseFactoryFactory

Zend\Expressive\Hal\LinkGeneratorFactory

Zend\Expressive\Hal\LinkGenerator\ExpressiveUrlGeneratorFactory

Zend\Expressive\Hal\LinkGenerator\UrlGeneratorInterface

You can either define an alternate alias, or map the UrlGeneratorInterface service directly to a factory that will return a valid instance.

Zend\Expressive\Hal\Metadata\MetadataMapFactory

This service uses the Zend\Expressive\Hal\Metadata\MetadataMap key of the config service in order to configure and return a Zend\Expressive\Hal\Metadata\MetadataMap instance. It expects that value to be an array of elements, each with the following structure:

[
    '__class__' => 'Fully qualified class name of an AbstractMetadata type',
    // additional key/value pairs as required by the metadata type.
]

The additional pairs are as follows:

If you have created custom metadata types, you can extend this class to support them. Create create<type>(array $metadata) methods for each type you wish to support, where <type> is your custom class name, minus the namespace.

Limitation

There is a known limitation with zend-router when using routes with optional parameters (e.g., /books[/:id], where :id is optional). In such cases, if no matching parameter is provided (such as when generating a URI without an :id), the router will raise an exception due to the missing parameter.

If you encounter this issue, create separate routing entries for each optional parameter. See the issue for a comprehensive example.

Zend\Expressive\Hal\ResourceGeneratorFactory

If you wish to use a container implementation other than the Zend\Hydrator\HydratorPluginManager, either register it under that service name, or create an alternate factory.