1. Go to this page and download the library: Download codenamegary/url-parser 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/ */
$url = new codenamegary\urlparser\URL('https://maps.google.ca/maps?saddr=Tokyo,+Japan&daddr=Toronto,+ON&hl=en&sll=43.653226,-79.383184&sspn=0.444641,1.056747&geocode=FRCUIAIduoZTCCnnVy7whxtdYDGJG1cii2EBLg%3BFWoYmgIdcLVE-ymlO8bXkMvUiTF3xLQqUFU1Mg&oq=tokyo&mra=ls&t=m&z=3');
$url->stripQuery('geocode');
echo $url->make();
// .. and strip all the segments and query string from the URI
$url = new codenamegary\urlparser\URL;
$url->stripSegments()
->stripQueries()
->make();
echo $url;
$url = new codenamegary\urlparser\URL('http://www.apple.com/bananas/coconut/date/elephant/giraffe');
$url->swapSegment('date','raisin');
echo $url->make();
$url = new codenamegary\urlparser\URL('http://www.apple.com/bananas/coconut/date/elephant/giraffe')
->prependSegment('lime','coconut');
echo $url->make();