PHP 8.5.0 Alpha 4 available for testing

Voting

: four plus four?
(Example: nine)

The Note You're Voting On

Rob
10 years ago
I've been working on a generic class that would make URI parsing / building a little easier.

The composer package is here: https://packagist.org/packages/enrise/urihelper

And the repository is here: https://github.com/Enrise/UriHelper

An example of the usage:

<?php
$uri
= new \Enrise\Uri('http://usr:[email protected]:81/mypath/myfile.html?a=b&b[]=2&b[]=3#myfragment');
echo
$uri->getScheme(); // http
echo $uri->getUser(); // usr
echo $uri->getPass(); // pss
echo $uri->getHost(); // example.com
echo $uri->getPort(); // 81
echo $uri->getPath(); // /mypath/myfile.html
echo $uri->getQuery(); // a=b&b[]=2&b[]=3
echo $uri->getFragment(); // myfragment
echo $uri->isSchemeless(); // false
echo $uri->isRelative(); // false

$uri->setScheme('scheme:child:scheme.VALIDscheme123:');
$uri->setPort(null);

echo
$uri->getUri(); //scheme:child:scheme.VALIDscheme123:usr:[email protected]/mypath/myfile.html?a=b&b[]=2&b[]=3#myfragment
?>

<< Back to user notes page

To Top