Uri Components

Build Status Latest Version

This package contains classes to help parsing and modifying URI components.

use League\Uri\Components\Query;
use League\Uri\Uri;
use League\Uri\UriModifier;

$uri = Uri::createFromString('http://example.com?q=value#fragment');
$newUri = UriModifier::appendQuery($uri, 'q=new.Value');
echo $newUri; // 'http://example.com?q=value&q=new.Value#fragment';

$query = Query::createFromUri($newUri);
$query->get('q');    // returns 'value'
$query->getAll('q'); // returns ['value', 'new.Value']
$query->params('q'); // returns 'new.Value'

System Requirements

You need PHP >= 7.2 but the latest stable version of PHP is recommended

If you want to handle:

Trying to process such hosts without meeting those minimal requirements will trigger a RuntimeException.


$ composer require league/uri-components


What you will be able to do