seebz / uri-template

Implementation of RFC-6570 (Template URI) in a single PHP function

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

uri_template()

Implementation of RFC 6570 (URI Template) in a single PHP function.

Installation

Install the latest version with composer:

$ composer require seebz/uri-template

Usage

<?php

require 'vendor/autoload.php';


$template = 'https://api.github.com/repos{/user,repo,function,id}';
$variables = array(
	'user'     => 'Seebz',
	'repo'     => 'uri-template',
	'function' => 'commits',
);

$uri = uri_template($template, $variables);
// "https://api.github.com/repos/Seebz/uri-template/commits"

License

Simply do what the fuck you want.

About

Implementation of RFC-6570 (Template URI) in a single PHP function

License:Do What The F*ck You Want To Public License


Languages

Language:PHP 100.0%