retrinko / url-composer
Basic URL composer
v0.7
2016-07-07 07:24 UTC
Requires
- php: >=5.5.0
- ext-intl: *
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is not auto-updated.
Last update: 2025-01-18 21:19:33 UTC
README
retrinko/url-composer
Basic URL composer for PHP.
Installation
Install the latest version with
$ composer require retrinko/url-composer
Dependencies
This library requires the php's intl extension to work.
Basic usage
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Retrinko\UrlComposer\UrlComposer;
try
{
$urlComposer = new UrlComposer('http://my-url.com');
$urlComposer->setUser('user')
->addToPath('blog')
->addToQuery('id', '25')
->setFragment('fragment');
$url = $urlComposer->compose();
printf('URL: %s' . PHP_EOL, $url);
}
catch (\Exception $e)
{
printf('Exception!: %s' . PHP_EOL, $e->getMessage());
}