UrlRegistry
in
Provides an interface for defining a URL registry.
Table of Contents
Methods
- format() : string
- Format a URL.
- register() : void
- Registers a URL format.
- scopeTo() : UrlRegistry
- Creates a scoped URL registry.
Methods
format()
Format a URL.
public
format(string $name[, array<string, mixed> $vars = [] ][, bool $spacesAsPlus = false ]) : string
Parameters
- $name : string
-
Name of the URL to format.
- $vars : array<string, mixed> = []
-
Values to replace the variables in the path, query and fragment with.
- $spacesAsPlus : bool = false
-
Whether to represent spaces as a + instead of %20.
Return values
string —Formatted URL.
register()
Registers a URL format.
public
register(UrlSource|string $nameOrSource[, string $path = '' ][, array<string, string> $query = [] ][, string $fragment = '' ]) : void
TODO: explain formatting system
Parameters
- $nameOrSource : UrlSource|string
-
Name of the format or a URL source object.
- $path : string = ''
-
Path portion of the URL. Required if $nameOrSource is a name string.
- $query : array<string, string> = []
-
Query string variables of the URL.
- $fragment : string = ''
-
Fragment portion of the URL.
Tags
scopeTo()
Creates a scoped URL registry.
public
scopeTo([string $namePrefix = '' ][, string $pathPrefix = '' ]) : UrlRegistry
Parameters
- $namePrefix : string = ''
-
String to prefix names in the scope with.
- $pathPrefix : string = ''
-
String to prefix paths in the scope with, must start with / if not empty.
Tags
Return values
UrlRegistry —A scoped URL registry.