1. Go to this page and download the library: Download madkom/uri library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
madkom / uri example snippets
use Madkom\Uri\UriFactory;
use Madkom\Uri\Uri;
$factory = new UriFactory();
/** @var Uri $uri */
$uri = $factory->createUri('http://user:[email protected]/some/path?and=query¶m=2#fragment');
$uri->getScheme(); // Instance of \Madkom\Uri\Scheme\Http
$uri->getAuthority(); // Instance of \Madkom\Uri\Authority
$uri->getPath(); // Instance of \Madkom\Uri\Path
$uri->getQuery(); // Instance of \Madkom\Uri\Query
use Madkom\Uri\UriFactory;
use Madkom\Uri\Uri;
use Madkom\Uri\UriReference;
$factory = new UriFactory();
/** @var Uri $uri */
$uri = $factory->createUri('http://user:[email protected]/some/path?and=query¶m=2#fragment');
/** @var UriReference $uriReference */
$uriReference = $factory->createUriReference('../another/path?and=different');
(string)$uriReference->resolveUri($uri); // http://user:[email protected]/some/another/path?and=different
use Madkom\Uri\UriFactory;
use Madkom\Uri\Uri;
$factory = new UriFactory();
/** @var Uri $uri */
$uri = $factory->createUri('isbn:978-83-283-0525-0'); // Instance of \Madkom\Uri\Uri
$uri->getScheme(); // Instance of \Madkom\Uri\Scheme\Custom
$uri->getAuthority(); // NULL
$uri->getPath(); // Instance of \Madkom\Uri\Path with "978-83-283-0525-0"
$uri->getQuery(); // Instance of \Madkom\Uri\Query which is empty
use Madkom\Uri\Uri;
use Madkom\Uri\Scheme\Https;
use Madkom\Uri\Authority;
use Madkom\Uri\Authority\Host\IPv6;
use Madkom\Uri\Authority\UserInfo;
use Madkom\Uri\Path;
use Madkom\Uri\Query;
use Madkom\Uri\Query\Parameter;
/** @var Uri $uri */
$uri = new Uri(
new Https(),
new Authority(
new IPv6('::1'),
443,
new UserInfo('user', 'pass')
),
new Path([
'some',
'path'
]),
new Query([
new Parameter('name', 'value')
])
);
$uri->toString(); // https://user:pass@[::1]:443/some/path?name=value
(string)$uri; // same as above
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.