The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started


Uri Schemes

Uri manipulation

Uri Parts API


Upgrading Guide

This is the documentation for the unsupported version 4.0. Please consider upgrading your code to the latest stable version

The Pass component

The library provides a Pass class to ease user creation and manipulation.


Using the default constructor.


public function __contruct($pass = null)

The constructor accepts:



use League\Uri\Components\Pass;

$user = new Pass('jo@hn');
echo $user->getContent();      //display 'jo%40hn'
echo $user;                    //display 'jo%40hn'
echo $user->getUriComponent(); //display 'jo%40hn'

$user = new Pass();
echo $user->getContent();      //display null
echo $user;                    //display ''
echo $user->getUriComponent(); //display ''

If the submitted value is not a valid an InvalidArgumentException exception is thrown.

On instantiation the submitted string is normalized using RFC3986 rules.

Using a League Uri object

You can access a Pass object with an already instantiated Uri object.


use League\Uri\Schemes\Http as HttpUri;

$uri = HttpUri::createFromString('');
$pass = $uri->pass; // $user is a League\Uri\Components\Pass object;

Properties and Methods

The component representation, comparison and manipulation is done using the package UriPart and the Component interfaces methods.


New in version 4.2


public function Pass::getDecoded(void): null|string

Returns the decoded value of the component getContent method


use League\Uri\Components\Pass;

$user = new Pass('frag%20ment');
$user->getContent(); // display 'frag%40ment'
$user->getDecoded();   // display 'frag@ment'