The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started

Uri functions

Uri parser

Uri schemes

Uri manipulations

Uri components

Uri Domain Parser

Upgrading Guide

URI Builder


use League\Uri;

function build(array $components): string

Uri\build is available since version 1.1.0

You can rebuild a URI from its hash representation returned by the Parser::__invoke method or PHP’s parse_url function using the helper function Uri\build.

If you supply your own hash you are responsible for providing valid encoded components without their URI delimiters.


use League\Uri;

$base_uri = '';
$components = Uri\parse($base_uri);
//returns the following array
//  'scheme' => 'http',
//  'user' => 'hello',
//  'pass' => 'world',
//  'host' => '',
//  'port' => null,
//  'path' => '',
//  'query' => '',
//  'fragment' => null,

$uri = Uri\build($components);

echo $uri; //displays

The Uri\build function never output the pass component as suggested by RFC3986.