Implementation of RFC 6570 (URI Template) in a single PHP function.
Install the latest version with composer:
$ composer require seebz/uri-template
<?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"
Simply do what the fuck you want.