PHP code example of hcelebi / url-parser-tool
1. Go to this page and download the library: Download hcelebi/url-parser-tool 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/ */
hcelebi / url-parser-tool example snippets
$url = "http://www.xxx.com/search/?k=word";
$urlType = new Url($url);
//Get query params as array
$query = $urlType->getQuery()->toArray();
//Get uri path
$path = $urlType->getPath();
//Update query param
$urlType->getQuery()->set("k" => "wordxx");