Url
class Url (View source)
Constants
| SCHEME_ALIGN |
|
| HOST_IDNA_ASCII |
|
| PATH_ASCII |
|
| PATH_RESOLVE |
|
| PATH_SLUG |
|
| PATH_UNICODE |
|
| SORT_QUERY |
|
Properties
| string | $scheme | ||
| string | $host | ||
| string | $port | ||
| string | $user | ||
| string | $pass | ||
| string | $path | ||
| string | $query | ||
| string | $fragment |
Methods
__construct(string $url)
Parse URL
static
setSchemePorts(array $ports)
Set default ports associated with specific schemes.
static
setSlugDict(array $dict)
Set slug dictionary
static Url
application(bool $appendQuery)
Get Url instance from current url
modify(int $flags)
Creates a new object with modified:
- Scheme is modified if the SCHEME_ALIGN flag is used
- Host is modified if the HOST_IDNA_ASCII flag is used
- Path is modified if the PATH_ASCII, PATH_UNICODE, or PATH_SLUG flags are used
- Query fields are sorted if the SORT_QUERY flag is used
string|array|null
__get($component)
Get value for a URL component
Note: $instance->query returns an array if the component is present
__set(string $component, string|array|null $value)
Set value for a URL component
string
__toString()
Returns a string encoding only what is necessary
Details
__construct(string $url)
Parse URL
static
setSchemePorts(array $ports)
Set default ports associated with specific schemes.
static
setSlugDict(array $dict)
Set slug dictionary
static Url
application(bool $appendQuery)
Get Url instance from current url
Url
modify(int $flags)
Creates a new object with modified:
- Scheme is modified if the SCHEME_ALIGN flag is used
- Host is modified if the HOST_IDNA_ASCII flag is used
- Path is modified if the PATH_ASCII, PATH_UNICODE, or PATH_SLUG flags are used
- Query fields are sorted if the SORT_QUERY flag is used
Url
with(string $target, string $newValue)
Creates a new object with modified component
string|array|null
__get($component)
Get value for a URL component
Note: $instance->query returns an array if the component is present
__set(string $component, string|array|null $value)
Set value for a URL component
string
__toString()
Returns a string encoding only what is necessary