PHP code example of rkr / url
1. Go to this page and download the library: Download rkr/url 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/ */
rkr / url example snippets
$url = new Url('/subpath?a=1', 'http://example.org/#test');
echo (string) $url; // http://example.org/subpath?a=1#test
var_dump($url->getScheme());
var_dump($url->getUsername());
var_dump($url->getPassword());
var_dump($url->getHost());
var_dump($url->getPort());
var_dump($url->getPath());
var_dump($url->getQuery());
var_dump($url->getFragment());