PHPackages                             innmind/url-template - 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. innmind/url-template

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

innmind/url-template
====================

Url template expansion processor

4.0.0(5mo ago)427.4k↓73%15MITPHPPHP ~8.4CI passing

Since May 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Innmind/UrlTemplate)[ Packagist](https://packagist.org/packages/innmind/url-template)[ Docs](http://github.com/Innmind/UrlTemplate)[ RSS](/packages/innmind-url-template/feed)WikiDiscussions develop Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (12)Used By (5)

UrlTemplate
===========

[](#urltemplate)

[![Build Status](https://github.com/innmind/urltemplate/workflows/CI/badge.svg?branch=master)](https://github.com/innmind/urltemplate/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/de2e435fef57248647ed94a1ad76d4625dde04377cd9c558129ef25e5aad5bce/68747470733a2f2f636f6465636f762e696f2f67682f696e6e6d696e642f75726c74656d706c6174652f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/innmind/urltemplate)[![Type Coverage](https://camo.githubusercontent.com/eaa91db59017b8235c15ad0241d1bf23cd807271b8bb126e65ab7d3e059642ab/68747470733a2f2f73686570686572642e6465762f6769746875622f696e6e6d696e642f75726c74656d706c6174652f636f7665726167652e737667)](https://shepherd.dev/github/innmind/urltemplate)

[RFC6570](https://tools.ietf.org/html/rfc6570) implementation.

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

[](#installation)

```
composer require innmind/url-template
```

Usage
-----

[](#usage)

```
use Innmind\UrlTemplate\Template;
use Innmind\Immutable\Map;
use Innmind\Url\Url;

$url = Template::of('http://example.com/dictionary/{term:1}/{term}')->expand(
    Map::of(['term', 'dog']),
);
$url instanceof Url; // true
$url->toString(); // http://example.com/dictionary/d/dog

$variables = Template::of('http://example.com/dictionary/{term:1}/{term}')->extract(
    Url::of('http://example.com/dictionary/d/dog')
);
$variables; // Map
$variables->size(); // 1
$variables->get('term'); // dog
```

*Important*: variable extraction is not supported for list (ie `{foo*}` expression).

###  Health Score

57

—

FairBetter than 98% of packages

Maintenance79

Regular maintenance activity

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 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 ~313 days

Recently: every ~553 days

Total

10

Last Release

160d ago

Major Versions

1.2.2 → 2.0.02020-01-05

2.1.0 → 3.0.02022-08-06

3.1.0 → 4.0.02026-01-25

PHP version history (6 changes)1.0.0PHP ~7.2

2.0.0PHP ~7.4

2.1.0PHP ~7.4|~8.0

3.0.0PHP ~8.1

3.1.0PHP ~8.2

4.0.0PHP ~8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (178 commits)")

---

Tags

rfc-6570rfc6570url template

### Embed Badge

![Health badge](/badges/innmind-url-template/health.svg)

```
[![Health](https://phpackages.com/badges/innmind-url-template/health.svg)](https://phpackages.com/packages/innmind-url-template)
```

PHPackages © 2026

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