PHPackages                             rize/uri-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. [Templating &amp; Views](/categories/templating)
4. /
5. rize/uri-template

ActiveLibrary[Templating &amp; Views](/categories/templating)

rize/uri-template
=================

PHP URI Template (RFC 6570) supports both expansion &amp; extraction

0.4.1(5mo ago)420137.3M—1%16[1 issues](https://github.com/rize/UriTemplate/issues)20MITPHPPHP &gt;=8.1CI passing

Since Mar 31Pushed 1w ago9 watchersCompare

[ Source](https://github.com/rize/UriTemplate)[ Packagist](https://packagist.org/packages/rize/uri-template)[ Fund](https://www.paypal.me/rezigned)[ GitHub Sponsors](https://github.com/rezigned)[ RSS](/packages/rize-uri-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (26)Used By (20)

PHP URI Template
================

[](#php-uri-template)

This is a URI Template implementation in PHP based on [RFC 6570 URI Template](http://tools.ietf.org/html/rfc6570). In addition to URI expansion, it also supports URI extraction (used by [Google Cloud Core](https://github.com/googleapis/google-cloud-php-core) and [Google Cloud Client Library](https://github.com/googleapis/google-cloud-php)).

[![CI](https://github.com/rize/UriTemplate/workflows/CI/badge.svg)](https://github.com/rize/UriTemplate/workflows/CI/badge.svg) [![Total Downloads](https://camo.githubusercontent.com/68f35c72ab8face39e0cc58559b122db6e9465bcce64783628eefbf6c35f3536/68747470733a2f2f706f7365722e707567782e6f72672f72697a652f7572692d74656d706c6174652f646f776e6c6f616473)](https://packagist.org/packages/rize/uri-template) [![Latest Stable Version](https://camo.githubusercontent.com/3aab40afe802aecd45d0e54a708504224beba41d3f348e4552e33021dcebd5ac/68747470733a2f2f706f7365722e707567782e6f72672f72697a652f7572692d74656d706c6174652f76)](https://packagist.org/packages/rize/uri-template) [![PHP Version Require](https://camo.githubusercontent.com/e0d00e4b9ab659efb604ae5614d344c0f01f1486c8ce5ede19f6bb0e16fcdadd/68747470733a2f2f706f7365722e707567782e6f72672f72697a652f7572692d74656d706c6174652f726571756972652f706870)](https://packagist.org/packages/rize/uri-template)

Note

Due to the deprecation of implictly nullable parameter types in [PHP 8.4](https://wiki.php.net/rfc/deprecate-implicitly-nullable-types), we must introduce breaking change by adding explicit nullable types (`?T`) which requires PHP 7.1+.

As a result, version [0.4.0](https://github.com/rize/UriTemplate/releases/tag/0.4.0) and later will no longer support PHP versions below 8.1.

Usage
-----

[](#usage)

### Expansion

[](#expansion)

A very simple usage (string expansion).

```
