PHPackages                             tthe/php-tag-scheme - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tthe/php-tag-scheme

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tthe/php-tag-scheme
===================

PHP implementation of RFC 4151: The 'tag' URI Scheme

v1.1.0(2y ago)06MITPHPPHP &gt;=8.2

Since Oct 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/dekadans/php-tag-scheme)[ Packagist](https://packagist.org/packages/tthe/php-tag-scheme)[ RSS](/packages/tthe-php-tag-scheme/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

TagScheme
=========

[](#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](https://www.taguri.org/) and [the RFC](https://www.rfc-editor.org/rfc/rfc4151).

Installation
------------

[](#installation)

[Composer](https://getcomposer.org/):

```
composer require tthe/php-tag-scheme

```

Basic Usage
-----------

[](#basic-usage)

```
$te = new \tthe\TagScheme\TaggingEntity('example.org');
$tag = $te->mint('something');

echo $tag; // Prints "tag:example.org,2023-10-22:something"
```

Tagging Entity
--------------

[](#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`.

```
use tthe\TagScheme\TaggingEntity;
use tthe\TagScheme\Util\DateUtil;

// The tagging authority can be either domain name or an e-mail address.
$authority = 'example.org';

// If no date is provided it will default to today.
$te1 = new TaggingEntity($authority);

// We can also set it to January 1 of the current year...
$te2 = new TaggingEntity($authority, DateUtil::FIRST_OF_YEAR);

// ...or the first day of the current month...
$te3 = new TaggingEntity($authority, DateUtil::FIRST_OF_MONTH);

// ...or an explicit date.
$te4 = new TaggingEntity($authority, DateUtil::date('2020-04-17'));
```

Tag Objects
-----------

[](#tag-objects)

Minted tag URIs are objects implementing `TagInterface`, and extends `Stringable` and `JsonSerializable`.

```
use tthe\TagScheme\TaggingEntity;
use tthe\TagScheme\Util\DateUtil;

$te = new TaggingEntity('demo@example.org', DateUtil::FIRST_OF_YEAR);
$tag = $te->mint('something');

echo $tag->toString();
// tag:demo@example.org,2023:something

echo $tag->getAuthority()->value();
// demo@example.org

echo $tag->getDate()->value()->format('Y-m-d');
// 2023-01-01

echo $tag->getResource()->value();
// something
```

Parsing Strings
---------------

[](#parsing-strings)

It's also possible to do it the other way around:

```
$s = 'tag:example.org,2023:something';
$tag = \tthe\TagScheme\Tag::fromString($s);

echo $tag->getResource()->value();
// something
```

Query Parameters and Fragments
------------------------------

[](#query-parameters-and-fragments)

Tags, like all URIs, support query and fragment components. However, preserving human readability should always be prioritized.

```
use tthe\TagScheme\TaggingEntity;
use tthe\TagScheme\Util\DateUtil;

$te = new TaggingEntity('demo@example.org', DateUtil::FIRST_OF_YEAR);
echo $te->mint('something')
    ->withQuery(['param' => 'value'])
    ->withFragment('subresource');

// tag:demo@example.org,2023:something?param=value#subresource
```

PSR-7
-----

[](#psr-7)

For convenience, and despite the fact that tag URIs are not resolvable, a conversion method to the PSR-7 UriInterface is provided.

```
$s = 'tag:example.org,2023:something';
$tag = \tthe\TagScheme\Tag::fromString($s);

$psrImpl = $tag->toPsr7();
```

Classes and Interfaces
----------------------

[](#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.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

3

Last Release

938d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dcc67259b70298aa05fc48fbfe79c507e0b692c2225cd00ea32414db3a886faf?d=identicon)[dekadans](/maintainers/dekadans)

---

Top Contributors

[![dekadans](https://avatars.githubusercontent.com/u/1143146?v=4)](https://github.com/dekadans "dekadans (10 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/tthe-php-tag-scheme/health.svg)

```
[![Health](https://phpackages.com/badges/tthe-php-tag-scheme/health.svg)](https://phpackages.com/packages/tthe-php-tag-scheme)
```

###  Alternatives

[w7corp/easywechat

微信SDK

10.4k761.6k60](/packages/w7corp-easywechat)[aimeos/aimeos-base

Aimeos base layer for abstracting from host environments

2.1k134.0k1](/packages/aimeos-aimeos-base)[roach-php/core

A complete web scraping toolkit for PHP

1.5k352.4k3](/packages/roach-php-core)[tigitz/php-spellchecker

Provides an easy way to spellcheck multiple text source by many spellcheckers, directly from PHP

309498.4k1](/packages/tigitz-php-spellchecker)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
