Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 20, 2024 via composer

rize/uri-template 0.3.5

PHP URI Template (RFC 6570) supports both expansion & extraction
Package summary
Share
0
issues
1
license
1
MIT
Package created
31 Mar 2014
Version published
12 Oct 2022
Maintainers
1
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
rize/uri-template@0.3.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of rize/uri-template 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does rize/uri-template do?

Rize/UriTemplate is a powerful PHP library that offers an implementation of URI Templates according to RFC 6570. This ingenious package grants you the capability to perform both expansion and extraction of URIs. Beyond simple string templating, it also uniquely supports subtypes of URI expressions along with level-based implementation as detailed by RFC6570. It even boasts notable usage in Google Cloud Core and Google Cloud Client Library. The ability to manipulate and infer data from URIs makes this library a crucial tool for developers handling API endpoints.

How do you use rize/uri-template?

Using the Rize/UriTemplate package is a breeze. For starters, you must install it via Composer - add "rize/uri-template": "~0.3" to the require section of your composer.json file.

Once installed, you can incorporate the package into your code like any standard PHP class. Begin by using the use statement for Rize\UriTemplate.

To expand a URI template, you instatiate the UriTemplate class and call the expand method, passing in the URI pattern and an associative array of variables. For example:

<?php

use Rize\UriTemplate;

$uri = new UriTemplate();
echo $uri->expand('/{username}/profile', ['username' => 'john']);  // Outputs: /john/profile

The library also handles complex URI patterns and extraction. Suppose you wish to extract variables from a given URI:

<?php

use Rize\UriTemplate;

$uri = new UriTemplate();
$params = $uri->extract('/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?q=a&q=b&limit=10');
print_r($params);   // Outputs an array with term:1, term, q, limit as keys.

Use this rich functionality to simplify URIs handling and to effectively streamline your coding flow.

Where are the rize/uri-template docs?

The documentation for the Rize/UriTemplate library is primarily contained within the README on the library's GitHub page - https://github.com/rize/UriTemplate. This comprehensive guide takes you through each aspect of this robust library, providing illustrative examples and thorough explanations of both the URI expansion and extraction functionalities. Aimed at quick comprehension, it ensures you are able to efficiently leverage the package in your PHP development efforts. For more complex operational queries, consider the community of developers and users associated with this library – post your queries or explore previous discussions to more deeply understand and apply the offered functionalities.