PSR-13 - hypermedia links
The hypermedia links form an essential part of any web application, whether we are speaking about HTML or API formats. At the very minimum, each hypermedia link consists of a URI representing the target resource and a relationship defining how the target resource relates to the source. The target link must be an absolute URI or a relative URI, as defined by RFC 5988, or possibly a URI template as defined by RFC 6570.
The PSR-13 standard defines a series of interfaces that outline a common hypermedia format and a way to represent links between these formats:
Psr\Link\LinkInterface
Psr\Link\EvolvableLinkInterface
Psr\Link\LinkProviderInterface
Psr\Link\EvolvableLinkProviderInterface
These interfaces can be fetched via Composer as a part of the psr/link
package.
The following code snippet reflects the PSR-13 Psr\Link\LinkInterface
definition, which represents a single readable link object:
<?php namespace Psr\Link; interface LinkInterface { public function getHref(...