PHP code example of byjg / uri

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

    

byjg / uri example snippets


$uri = \ByJG\Util\Uri::getInstanceFromString("http://user:pa&@host");
print((string)$uri); // Will print "http://user:pa%26@host"

$uri = \ByJG\Util\Uri::getInstanceFromString("http://user:pa%26@host");
print((string)$uri); // Will print "http://user:pa%26@host"

$uri = \ByJG\Util\Uri::getInstanceFromString("http://host")
    ->withUserInfo("user", "pa%26");
print((string)$uri); // Will print "http://user:pa%2526@host"