Download the PHP package rize/uri-template without Composer
On this page you can find all versions of the php package rize/uri-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package uri-template
PHP URI Template
This is a URI Template implementation in PHP based on RFC 6570 URI Template. In addition to URI expansion, it also supports URI extraction (used by Google Cloud Core and Google Cloud Client Library).
- Node.js/Javascript URI Template
Usage
Expansion
A very simple usage (string expansion).
Rize\UriTemplate
supports all Expression Types
and Levels
specified by RFC6570.
/
Path segment expansion
Rize\UriTemplate
accepts base-uri
as a 1st argument and default params
as a 2nd argument. This is very useful when you're working with API endpoint.
Take a look at real world example.
Extraction
It also supports URI Extraction (extract all variables from URI). Let's take a look at the example.
Note that in the example above, result returned by extract
method has an extra keys named term:1
for prefix
modifier. This key was added just for our convenience to access prefix data.
strict
mode
Normally extract
method will try to extract vars from a uri even if it's partially matched. For example
With strict mode
, it will allow you to extract uri only when variables in template are fully matched with given uri.
Which is useful when you want to determine whether the given uri is matched against your template or not (in case you want to use it as routing service).
Array modifier %
By default, RFC 6570 only has 2 types of operators :
and *
. This %
array operator was added to the library because current spec can't handle array style query e.g. list[]=a
or key[user]=john
.
Example usage for %
modifier
Installation
Using composer
Changelogs
- 0.2.0 Add a new modifier
%
which allows user to uselist[]=a&list[]=b
query pattern. - 0.2.1 Add nested array support for
%
modifier - 0.2.5 Add strict mode support for
extract
method - 0.3.0 Improve code quality + RFC3986 support for
extract
method by @Maks3w - 0.3.1 Improve
extract
method to parse two or more adjacent variables separated by dot by @corleonis
Contributors
Code Contributors
This project exists thanks to all the people who contribute. [Contribute].
Financial Contributors
Become a financial contributor and help us sustain our community. [Contribute]
Individuals
Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]