URL
URL
Generate a URL relative to the application.
This is the base method for generating URLs in your application. URLs generated directly from here are relative to the application base path.
Parameters are dynamic and depend on what you are trying to generate.
For examples see Generating URLs in the Hazaar documentation.
Properties
baseURL
public string $baseURLaliases
public array $aliasesMethods
__construct
Constructs a new URL object relative to the application base path.
public __construct(mixed $args): voidAccepts a variable number of arguments, which can be path segments (as strings), arrays or stdClass objects for query parameters, or strings containing query parameters.
Examples: new URL('controller', 'action', ['id' => 1]);new URL('controller/action?id=1&foo=bar');
Parameters
| Parameter | Type | Description |
|---|---|---|
$args | mixed |
build
Creates a new instance of the URL class using the provided URL string.
public build(string $url): selfParameters
| Parameter | Type | Description |
|---|---|---|
$url | string | The URL string to initialize the instance with. Defaults to an empty string. |
initialise
Initializes the URL class with the provided configuration.
public initialise(array $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | the configuration object containing the base URL, rewrite URL, and default controller |
resolveConnectionDetails
Resolves and constructs the base connection URL using server variables.
private resolveConnectionDetails(): stringDetermines the protocol (http/https), host (with port if non-standard), and appends the application path.
Generated by Hazaar API Doc Generator on Sun, 01 Mar 2026 09:22:26 +0000