Download the PHP package tthe/php-tag-scheme without Composer
On this page you can find all versions of the php package tthe/php-tag-scheme. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tthe/php-tag-scheme
More information about tthe/php-tag-scheme
Files in tthe/php-tag-scheme
Package php-tag-scheme
Short Description PHP implementation of RFC 4151: The 'tag' URI Scheme
License MIT
Informations about the package php-tag-scheme
TagScheme
A PHP implementation of RFC 4151: The 'tag' URI Scheme.
A Tag URI is an identifier for a specific resource tied to a domain name or e-mail address at a given point in time.
It can look something like tag:example.org,2023:resource
.
It can be used when something should be identified using a human-readable URI, instead of non-resolvable HTTP URIs.
More information at taguri.org and the RFC.
Installation
Basic Usage
Tagging Entity
Tag URIs are created through a TaggingEntity
object based on a domain name or an e-mail address and a date.
The date defaults to today but can be set in various ways using DateUtil
.
Tag Objects
Minted tag URIs are objects implementing TagInterface
, and extends Stringable
and JsonSerializable
.
Parsing Strings
It's also possible to do it the other way around:
Query Parameters and Fragments
Tags, like all URIs, support query and fragment components. However, preserving human readability should always be prioritized.
PSR-7
For convenience, and despite the fact that tag URIs are not resolvable, a conversion method to the PSR-7 UriInterface is provided.
Classes and Interfaces
\tthe\TagScheme\TaggingEntity
implements \tthe\TagScheme\Contracts\TaggingEntityInterface
\tthe\TagScheme\Tag
implements \tthe\TagScheme\Contracts\TagInterface
A possible pattern can be to initiate a TaggingEntity object centrally in your project and map it to TaggingEntityInterface in your dependency injection container.