PHP code example of kusabi / uri

1. Go to this page and download the library: Download kusabi/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/ */

    

kusabi / uri example snippets


use Kusabi\Uri\Uri;

// Instantiate a Uri instance
$uri = new Uri('https://user:[email protected]:8080/users/22?filter=name#bottom');

// Fetch the properties of the Uri instance
echo $uri->getScheme();
echo $uri->getAuthority();
echo $uri->getUserInfo();
echo $uri->getHost();
echo $uri->getPort();
echo $uri->getPath();
echo $uri->getQuery();
echo $uri->getFragment();

use Kusabi\Uri\UriFactory;

// Instantiate a Uri instance
$factory = new UriFactory();
$uri = $factory->createUri('https://user:[email protected]:8080/users/22?filter=name#bottom');

// Fetch the properties of the Uri instance
echo $uri->getScheme();
echo $uri->getAuthority();
echo $uri->getUserInfo();
echo $uri->getHost();
echo $uri->getPort();
echo $uri->getPath();
echo $uri->getQuery();
echo $uri->getFragment();