Documentation

Encoder
in package

FinalYes

Table of Contents

Constants

REGEXP_CHARS_ENCODED  = ',%[A-Fa-f0-9]{2},'
REGEXP_CHARS_INVALID  = '/[\x00-\x1f\x7f]/'
REGEXP_CHARS_PREVENTS_DECODING  = ',% 2[A-F|1-2|4-9]| 3[0-9|B|D]| 4[1-9|A-F]| 5[0-9|A|F]| 6[1-9|A-F]| 7[0-9|E] ,ix'
REGEXP_PART_ENCODED  = '%(?![A-Fa-f\d]{2})'
REGEXP_PART_SUBDELIM  = "\\!\$&'\\(\\)\\*\\+,;\\=%"
REGEXP_PART_UNRESERVED  = 'A-Za-z\d_\-.~'
REGEXP_UNRESERVED_CHARACTERS  = ',%(2[1-9A-Fa-f]|[3-7][0-9A-Fa-f]|61|62|64|65|66|7[AB]|5F),'
Unreserved characters.

Methods

decodeAll()  : string|null
Decodes all the URI component characters.
decodeFragment()  : string|null
Decodes the fragment component while preserving characters that should not be decoded in the context of a full valid URI.
decodeNecessary()  : string|null
Decodes the URI component without decoding the unreserved characters which are already encoded.
decodePartial()  : string|null
Decodes the URI component without decoding the unreserved characters which are already encoded.
decodePath()  : string|null
Decodes the path component while preserving characters that should not be decoded in the context of a full valid URI.
decodeQuery()  : string|null
Decodes the query component while preserving characters that should not be decoded in the context of a full valid URI.
decodeUnreservedCharacters()  : string|null
Decodes the component unreserved characters.
encodePassword()  : string|null
Encode Password.
encodePath()  : string
Encode Path.
encodeQueryKeyValue()  : string|null
encodeQueryOrFragment()  : string|null
Encode Query or Fragment.
encodeUser()  : string|null
Encode User.
encodeUserInfo()  : string|null
isFragmentEncoded()  : bool
Tell whether the query component is correctly encoded.
isPasswordEncoded()  : bool
Tell whether the password component is correctly encoded.
isPathEncoded()  : bool
Tell whether the path component is correctly encoded.
isQueryEncoded()  : bool
Tell whether the query component is correctly encoded.
isUserEncoded()  : bool
Tell whether the user component is correctly encoded.
isUserInfoEncoded()  : bool
Tell whether the userInfo component is correctly encoded.
normalizeFragment()  : string|null
Normalize the fragment component.
normalizeHost()  : string|null
Normalize the host component.
normalizePassword()  : string|null
Normalize password component.
normalizePath()  : string|null
Normalize path component.
normalizeQuery()  : string|null
Normalize the query component.
normalizeUser()  : string|null
Normalize user component.
normalizeUserInfo()  : string|null
decode()  : string|null
Decodes the URI component characters using a closure.
encode()  : string|null
Encodes the URI component characters using a regular expression to find which characters need encoding.
filterComponent()  : string|null
normalize()  : string|null

Constants

REGEXP_CHARS_ENCODED

private mixed REGEXP_CHARS_ENCODED = ',%[A-Fa-f0-9]{2},'

REGEXP_CHARS_INVALID

private mixed REGEXP_CHARS_INVALID = '/[\x00-\x1f\x7f]/'

REGEXP_CHARS_PREVENTS_DECODING

private mixed REGEXP_CHARS_PREVENTS_DECODING = ',% 2[A-F|1-2|4-9]| 3[0-9|B|D]| 4[1-9|A-F]| 5[0-9|A|F]| 6[1-9|A-F]| 7[0-9|E] ,ix'

REGEXP_PART_ENCODED

private mixed REGEXP_PART_ENCODED = '%(?![A-Fa-f\d]{2})'

REGEXP_PART_SUBDELIM

private mixed REGEXP_PART_SUBDELIM = "\\!\$&'\\(\\)\\*\\+,;\\=%"

REGEXP_PART_UNRESERVED

private mixed REGEXP_PART_UNRESERVED = 'A-Za-z\d_\-.~'

Methods

decodeAll()

Decodes all the URI component characters.

public static decodeAll(Stringable|string|null $component) : string|null
Parameters
$component : Stringable|string|null
Return values
string|null

decodeFragment()

Decodes the fragment component while preserving characters that should not be decoded in the context of a full valid URI.

public static decodeFragment(Stringable|string|null $path) : string|null
Parameters
$path : Stringable|string|null
Return values
string|null

decodeNecessary()

Decodes the URI component without decoding the unreserved characters which are already encoded.

public static decodeNecessary(Stringable|string|int|null $component) : string|null
Parameters
$component : Stringable|string|int|null
Return values
string|null

decodePartial()

Decodes the URI component without decoding the unreserved characters which are already encoded.

public static decodePartial(Stringable|string|int|null $component) : string|null

Since version 7.6.0

use League\Uri\Encoder::decodeNecessary() instead

DEPRECATION WARNING! This method will be removed in the next major point release.

Parameters
$component : Stringable|string|int|null
Tags
codeCoverageIgnore
see
Encoder::decodeNecessary()

Create a new instance from the environment.

Return values
string|null

decodePath()

Decodes the path component while preserving characters that should not be decoded in the context of a full valid URI.

public static decodePath(Stringable|string|null $path) : string|null
Parameters
$path : Stringable|string|null
Return values
string|null

decodeQuery()

Decodes the query component while preserving characters that should not be decoded in the context of a full valid URI.

public static decodeQuery(Stringable|string|null $path) : string|null
Parameters
$path : Stringable|string|null
Return values
string|null

decodeUnreservedCharacters()

Decodes the component unreserved characters.

public static decodeUnreservedCharacters(Stringable|string|null $str) : string|null
Parameters
$str : Stringable|string|null
Return values
string|null

encodePassword()

Encode Password.

public static encodePassword(Stringable|string|null $component) : string|null

Generic delimiters ":" MUST NOT be encoded

Parameters
$component : Stringable|string|null
Return values
string|null

encodePath()

Encode Path.

public static encodePath(Stringable|string|null $component) : string

Generic delimiters ":", "@", and "/" MUST NOT be encoded

Parameters
$component : Stringable|string|null
Return values
string

encodeQueryKeyValue()

public static encodeQueryKeyValue(mixed $component) : string|null
Parameters
$component : mixed
Return values
string|null

encodeQueryOrFragment()

Encode Query or Fragment.

public static encodeQueryOrFragment(Stringable|string|null $component) : string|null

Generic delimiters ":", "@", "?", and "/" MUST NOT be encoded

Parameters
$component : Stringable|string|null
Return values
string|null

encodeUser()

Encode User.

public static encodeUser(Stringable|string|null $component) : string|null

All generic delimiters MUST be encoded

Parameters
$component : Stringable|string|null
Return values
string|null

encodeUserInfo()

public static encodeUserInfo(Stringable|string|null $userInfo) : string|null
Parameters
$userInfo : Stringable|string|null
Return values
string|null

isFragmentEncoded()

Tell whether the query component is correctly encoded.

public static isFragmentEncoded(Stringable|string|null $encoded) : bool
Parameters
$encoded : Stringable|string|null
Return values
bool

isPasswordEncoded()

Tell whether the password component is correctly encoded.

public static isPasswordEncoded(Stringable|string|null $encoded) : bool
Parameters
$encoded : Stringable|string|null
Return values
bool

isPathEncoded()

Tell whether the path component is correctly encoded.

public static isPathEncoded(Stringable|string|null $encoded) : bool
Parameters
$encoded : Stringable|string|null
Return values
bool

isQueryEncoded()

Tell whether the query component is correctly encoded.

public static isQueryEncoded(Stringable|string|null $encoded) : bool
Parameters
$encoded : Stringable|string|null
Return values
bool

isUserEncoded()

Tell whether the user component is correctly encoded.

public static isUserEncoded(Stringable|string|null $encoded) : bool
Parameters
$encoded : Stringable|string|null
Return values
bool

isUserInfoEncoded()

Tell whether the userInfo component is correctly encoded.

public static isUserInfoEncoded(Stringable|string|null $userInfo) : bool
Parameters
$userInfo : Stringable|string|null
Return values
bool

normalizeFragment()

Normalize the fragment component.

public static normalizeFragment(Stringable|string|null $fragment) : string|null

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.

Parameters
$fragment : Stringable|string|null
Return values
string|null

normalizePassword()

Normalize password component.

public static normalizePassword(Stringable|string|null $password) : string|null

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.

Parameters
$password : Stringable|string|null
Return values
string|null

normalizePath()

Normalize path component.

public static normalizePath(Stringable|string|null $component) : string|null

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.

Parameters
$component : Stringable|string|null
Return values
string|null

normalizeQuery()

Normalize the query component.

public static normalizeQuery(Stringable|string|null $query) : string|null

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.

Parameters
$query : Stringable|string|null
Return values
string|null

normalizeUser()

Normalize user component.

public static normalizeUser(Stringable|string|null $user) : string|null

The value returned MUST be percent-encoded, but MUST NOT double-encode any characters. To determine what characters to encode, please refer to RFC 3986.

Parameters
$user : Stringable|string|null
Return values
string|null

normalizeUserInfo()

public static normalizeUserInfo(Stringable|string|null $userInfo) : string|null
Parameters
$userInfo : Stringable|string|null
Return values
string|null

decode()

Decodes the URI component characters using a closure.

private static decode(Stringable|string|int|null $component, Closure $decoder) : string|null
Parameters
$component : Stringable|string|int|null
$decoder : Closure
Return values
string|null

encode()

Encodes the URI component characters using a regular expression to find which characters need encoding.

private static encode(Stringable|string|int|bool|null $component, string $pattern) : string|null
Parameters
$component : Stringable|string|int|bool|null
$pattern : string
Return values
string|null

filterComponent()

private static filterComponent(mixed $component) : string|null
Parameters
$component : mixed
Return values
string|null

normalize()

private static normalize(string|null $component) : string|null
Parameters
$component : string|null
Return values
string|null

        
On this page

Search results