| Type aliases |
AuthorityMap
|
array{user: ?string, pass: ?string, host: ?string, port: ?int}
|
#
|
ComponentMap
|
array{scheme: ?string, user: ?string, pass: ?string, host: ?string, port: ?int, path: string, query: ?string, fragment: ?string}
|
#
|
InputComponentMap
|
array{scheme?: ?string, user?: ?string, pass?: ?string, host?: ?string, port?: ?int, path?: ?string, query?: ?string, fragment?: ?string}
|
#
|
| Methods |
public
static
|
toIriString(BackedEnum|Stringable|string $uri): string
Generate an IRI string representation (RFC3987) from its parsed representation
returned by League\UriString::parse() or…
Generate an IRI string representation (RFC3987) from its parsed representation
returned by League\UriString::parse() or PHP's parse_url.
If you supply your own array, you are responsible for providing
valid components without their URI delimiters.
|
#
|
public
static
|
build(InputComponentMap $components): string
Generate a URI string representation from its parsed representation
returned by League\UriString::parse() or PHP's…
Generate a URI string representation from its parsed representation
returned by League\UriString::parse() or PHP's parse_url.
If you supply your own array, you are responsible for providing
valid components without their URI delimiters.
|
#
|
public
static
|
buildUri(
?string $scheme = null,
?string $authority = null,
?string $path = null,
?string $query = null,
?string $fragment = null,
): string
Generates a URI string representation based on RFC3986 algorithm.
Generates a URI string representation based on RFC3986 algorithm.
Valid URI component MUST be provided without their URI delimiters
but properly encoded.
|
#
|
public
static
|
buildAuthority(InputComponentMap $components): ?string
Generate a URI authority representation from its parsed representation.
Generate a URI authority representation from its parsed representation.
|
#
|
public
static
|
parseNormalized(Stringable|string $uri): ComponentMap
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Throws
|
#
|
public
static
|
normalize(Stringable|string $uri): string
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Throws
|
#
|
public
static
|
normalizeAuthority(Stringable|string|null $authority): ?string
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Parses and normalizes the URI following RFC3986 destructive and non-destructive constraints.
Throws
|
#
|
public
static
|
resolve(BackedEnum|Stringable|string $uri, BackedEnum|Stringable|string|null $baseUri = null): string
Resolves a URI against a base URI using RFC3986 rules.
Resolves a URI against a base URI using RFC3986 rules.
This method MUST retain the state of the submitted URI instance, and return
a URI instance of the same type that contains the applied modifications.
This method MUST be transparent when dealing with error and exceptions.
It MUST not alter or silence them apart from validating its own parameters.
Throws
|
#
|
public
static
|
removeDotSegments(Stringable|string $path): string
Filter Dot segment according to RFC3986.
Filter Dot segment according to RFC3986.
|
#
|
public
static
|
containsRfc3986Chars(Stringable|string $uri): bool
|
#
|
public
static
|
containsRfc3987Chars(Stringable|string $uri): bool
|
#
|
public
static
|
parse(BackedEnum|Stringable|string|int $uri): ComponentMap
Parse a URI string into its components.
Parse a URI string into its components.
This method parses a URI and returns an associative array containing any
of the various components of the URI that are present.
$components = UriString::parse('http://foo@test.example.com:42?query#');
var_export($components);
//will display
array(
'scheme' => 'http', // the URI scheme component
'user' => 'foo', // the URI user component
'pass' => null, // the URI pass component
'host' => 'test.example.com', // the URI host component
'port' => 42, // the URI port component
'path' => '', // the URI path component
'query' => 'query', // the URI query component
'fragment' => '', // the URI fragment component
);
The returned array is similar to PHP's parse_url return value with the following
differences:
- All components are always present in the returned array
- Empty and undefined component are treated differently. And empty component is
set to the empty string while an undefined component is set to the `null` value.
- The path component is never undefined
- The method parses the URI following the RFC3986 rules, but you are still
required to validate the returned components against its related scheme specific rules.
Throws
|
#
|
public
static
|
parseAuthority(BackedEnum|Stringable|string|null $authority): AuthorityMap
Parses the URI authority part.
Parses the URI authority part.
Throws
|
#
|
public
static
|
isValidScheme(BackedEnum|Stringable|string|null $scheme): bool
Tells whether the scheme component is valid.
Tells whether the scheme component is valid.
|
#
|
public
static
|
isValidHost(Stringable|string|null $host): bool
DEPRECATION WARNING! This method will be removed in the next major point release.
DEPRECATION WARNING! This method will be removed in the next major point release.
Deprecated
|
#
|