UrlGenerator
class Winter\Storm\Router\UrlGenerator
extends Illuminate\Routing\UrlGenerator
Extends
| Class | Description |
|---|---|
Illuminate\Routing\UrlGenerator
|
Methods
public
static
buildStr (array $query, string $prefix = "", string $argSeparator = null)
: string
Build a query string from an array returned from a parse_str call.
This function serves as a counterpart to the parse_str method available in PHP, and a userland implementation
of the http_build_str method provided by the PECL HTTP module. This allows a developer to parse a query string
to an array and make adjustments to the values before combining them into a valid query string.
Based off of the implentation at https://github.com/ivantcholakov/http_build_url/blob/master/http_build_url.php
| Property | Type | Description |
|---|---|---|
| $query | array |
array
The query variables, as an array. Must match what would returned from a |
| $prefix | string |
string
Optional top level prefix to prefix the variable names with |
| $argSeparator | string |
string
Argument separator to use (by default the INI setting arg_seperator.output will be used or "&" if neither are set) |
The generated query string
public
static
buildUrl (string | array | false | null $url, array $replace = [], int $flags = null, array $newUrl = [])
: string
Build a URL from an array returned from a parse_url call.
This function serves as a counterpart to the parse_url method available in PHP, and a userland implementation
of the http_build_url method provided by the PECL HTTP module. This allows a developer to parse a URL to an
array and make adjustments to the URL parts before combining them into a valid URL reference string.
Based off of the implentation at https://github.com/jakeasmith/http_build_url/blob/master/src/http_build_url.php and https://github.com/ivantcholakov/http_build_url/blob/master/http_build_url.php
NOTE: Key differences from the PECL implementation include NOT using the current request scheme / host / path to provide fallbacks for not present values (use Url::to() instead) and supporting providing query parameters as an array of values rather than just a query string.
| Property | Type | Description |
|---|---|---|
| $url | string | array | false | null |
string | array | false | null
The URL parts, as an array. Must match the structure returned from a |
| $replace | array |
array
The URL replacement parts. Allows a developer to replace certain sections of the URL with a different value. |
| $flags | int |
int
A bitmask of binary or'ed HTTP_URL constants. By default, this is set to HTTP_URL_REPLACE. |
| $newUrl | array |
array
If set, this will be filled with the array parts of the composed URL, similar to the return
value of |
The generated URL as a string
public
to (string $path, array $extra = [], bool | null $secure = null)
: string
Generate an absolute URL to the given path.
| Property | Type | Description |
|---|---|---|
| $path | string |
string
|
| $extra | array |
array
|
| $secure | bool | null |
bool | null
|