UrlGenerator
class UrlGenerator (View source)
Properties
protected RouteCollection | $routes | The route collection. | |
protected Request | $request | The request instance. | |
protected string | $forcedRoot | The force URL root. | |
protected string | $forceSchema | The forced schema for URLs. | |
protected array | $dontEncode | Characters that should not be URL encoded. |
Methods
void | __construct(RouteCollection $routes, Request $request) Create a new URL Generator instance. | |
string | full() Get the full URL for the current request. | |
string | current() Get the current URL for the request. | |
string | previous() Get the URL for the previous request. | |
string | to(string $path, mixed $extra = array(), bool|null $secure = null) Generate a absolute URL to the given path. | |
string | secure(string $path, array $parameters = array()) Generate a secure, absolute URL to the given path. | |
string | asset(string $path, bool|null $secure = null) Generate a URL to an application asset. | |
string | removeIndex(string $root) Remove the index.php file from a path. | |
string | secureAsset(string $path) Generate a URL to a secure asset. | |
string | getScheme(bool|null $secure) Get the scheme for a raw URL. | |
void | forceSchema(string $schema) Force the schema for URLs. | |
string | route(string $name, mixed $parameters = array(), bool $absolute = true, Route $route = null) Get the URL to a named route. | |
string | toRoute(Route $route, array $parameters, bool $absolute) Get the URL for a given route instance. | |
string | replaceRoot(Route $route, string $domain, array $parameters) Replace the parameters on the root path. | |
string | replaceRouteParameters(string $path, array $parameters) Replace all of the wildcard parameters for a route path. | |
string | replaceNamedParameters(string $path, array $parameters) Replace all of the named parameters in the path. | |
string | getRouteQueryString(array $parameters) Get the query string for a given route. | |
array | getStringParameters(array $parameters) Get the string parameters from a given list. | |
array | getNumericParameters(array $parameters) Get the numeric parameters from a given list. | |
string | getRouteDomain(Route $route, array $parameters) Get the formatted domain for a given route. | |
string | formatDomain(Route $route, array $parameters) Format the domain and port for the route and request. | |
string | getDomainAndScheme(Route $route) Get the domain and scheme for the route. | |
string | addPortToDomain(string $domain) Add the port to the domain if necessary. | |
string | getRouteRoot(Route $route, string $domain) Get the root of the route URL. | |
string | getRouteScheme(Route $route) Get the scheme for the given route. | |
string | action(string $action, mixed $parameters = array(), bool $absolute = true) Get the URL to a controller action. | |
string | getRootUrl(string $scheme, string $root = null) Get the base URL for the request. | |
void | forceRootUrl(string $root) Set the forced root URL. | |
bool | isValidUrl(string $path) Determine if the given path is a valid URL. | |
string | trimUrl(string $root, string $path, string $tail = '') Format the given URL segments into a single URL. | |
Request | getRequest() Get the request instance. | |
void | setRequest(Request $request) Set the current request instance. |
Details
void __construct(RouteCollection $routes, Request $request)
Create a new URL Generator instance.
string full()
Get the full URL for the current request.
string current()
Get the current URL for the request.
string previous()
Get the URL for the previous request.
string to(string $path, mixed $extra = array(), bool|null $secure = null)
Generate a absolute URL to the given path.
string secure(string $path, array $parameters = array())
Generate a secure, absolute URL to the given path.
string asset(string $path, bool|null $secure = null)
Generate a URL to an application asset.
protected string removeIndex(string $root)
Remove the index.php file from a path.
string secureAsset(string $path)
Generate a URL to a secure asset.
protected string getScheme(bool|null $secure)
Get the scheme for a raw URL.
void forceSchema(string $schema)
Force the schema for URLs.
string route(string $name, mixed $parameters = array(), bool $absolute = true, Route $route = null)
Get the URL to a named route.
protected string toRoute(Route $route, array $parameters, bool $absolute)
Get the URL for a given route instance.
protected string replaceRoot(Route $route, string $domain, array $parameters)
Replace the parameters on the root path.
protected string replaceRouteParameters(string $path, array $parameters)
Replace all of the wildcard parameters for a route path.
protected string replaceNamedParameters(string $path, array $parameters)
Replace all of the named parameters in the path.
protected string getRouteQueryString(array $parameters)
Get the query string for a given route.
protected array getStringParameters(array $parameters)
Get the string parameters from a given list.
protected array getNumericParameters(array $parameters)
Get the numeric parameters from a given list.
protected string getRouteDomain(Route $route, array $parameters)
Get the formatted domain for a given route.
protected string formatDomain(Route $route, array $parameters)
Format the domain and port for the route and request.
protected string getDomainAndScheme(Route $route)
Get the domain and scheme for the route.
protected string addPortToDomain(string $domain)
Add the port to the domain if necessary.
protected string getRouteRoot(Route $route, string $domain)
Get the root of the route URL.
protected string getRouteScheme(Route $route)
Get the scheme for the given route.
string action(string $action, mixed $parameters = array(), bool $absolute = true)
Get the URL to a controller action.
protected string getRootUrl(string $scheme, string $root = null)
Get the base URL for the request.
void forceRootUrl(string $root)
Set the forced root URL.
bool isValidUrl(string $path)
Determine if the given path is a valid URL.
protected string trimUrl(string $root, string $path, string $tail = '')
Format the given URL segments into a single URL.
Request getRequest()
Get the request instance.
void setRequest(Request $request)
Set the current request instance.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/4.2/Illuminate/Routing/UrlGenerator.html