PHP code example of martinmdev / php-url

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

    

martinmdev / php-url example snippets




artinm\Url\Url;

$url = new Url('http://example.com/path/to/index.php?x=1&y=2');

$url->getScheme(); // 'http'
$url->getHost(); // 'example.com'
$url->getPort(); // null
$url->getPath(); // '/path/to/index.php'
$url->getQuery(); // 'x=1&y=2'