PHP code example of thlib / php-url-modify

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

    

thlib / php-url-modify example snippets



$url = 'https://example.com';
$url = TH\UrlModify\Url::modifyQuery($url, ['a'=>1]); // https://example.com?a=1
$url = TH\UrlModify\Url::modifyQuery($url, ['a'=>2, 'b'=> 3]); // https://example.com?a=2&b=3
$url = TH\UrlModify\Url::modifyQuery($url, ['a'=>null]); // https://example.com?b=3

$url = TH\UrlModify\Url::modifyAnchor($url, 'newanchor'); // https://example.com#newanchor
$url = 'https://example.com#oldanchor';
$url = TH\UrlModify\Url::modifyAnchor($url, null); // https://example.com
$url = TH\UrlModify\Url::modifyAnchor($url, 'newanchor'); // https://example.com#newanchor

vendor/phpunit/phpunit/phpunit --bootstrap vendor/autoload.php tests