PHP code example of sanmai / parsed-url

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

    

sanmai / parsed-url example snippets


$url = new \ParsedUrl\ParsedUrl('https://www.example.com/index.html?foo=bar&baz=1');

var_dump($url->scheme); // string(5) "https"

var_dump($url->host); // string(15) "www.example.com"

var_dump($url->path); // "/index.html"

var_dump($url->query); // string(13) "foo=bar&baz=1"

var_dump($url->query()->foo); // string(3) "bar"