The pieces you need to implement, work with, or understand are:
- Writing event listeners for the various
PhlyRestfully\Resourceevents, which will be used to either persist resources or fetch resources from persistence.
- Writing routes for your resources, and associating them with resources and/or
- Writing metadata describing your resources, including what routes to associate with them.
All API calls are handled by
PhlyRestfully\ResourceController, which in
turn composes a
PhlyRestfully\Resource object and calls methods on it. The
various methods of the controller will return either
PhlyRestfully\ApiProblem results on error conditions, or, on success, a
PhlyRestfully\HalCollection instance; these
are then composed into a
If the MVC detects a
PhlyRestfully\View\RestfulJsonModel during rendering,
it will select
PhlyRestfully\View\RestfulJsonRenderer. This, with the help
PhlyRestfully\Plugin\HalLinks plugin, will generate an appropriate
payload based on the object composed, and ensure the appropriate Content-Type
header is used.
PhlyRestfully\HalCollection is detected, and the renderer determines
that it composes a
Zend\Paginator\Paginator instance, the
plugin will also generate pagination relational links to render in the payload.