This module allows you to easily create and modify URL's. e.g.

$url = ar::url( '' );
$url->path = '/docs/search/';
$url->query->searchstring = 'test';
echo $url;

This code echoes the following url:

You can change any of the following components:

scheme e.g. 'http'
user A user name to include in the url.
password A password to include in the url, will only be included if a username is also specified.
host The host name, e.g. ''.
port The port number.
path The path.
query The query string. This is also automatically parsed to an object and you can access any variable inside it as a normal php variable. See the example above. You can also use it as an array, it extends ArrayObject.
fragment The html fragment after the '#'.

When parsing a URL the query arguments are automatically tainted if tainting is enabled in ar\http.


(mixed) getvar Returns the named argument from the query part.
(void) import Imports a list of name => value pairs into the query.
(void) putvar Inserts a new named argument into the query.

These methods can be called on the URL directly or on the query part, there is no difference.


(mixed) $url->getvar( $name )
(mixed) $urlQuery->getvar( $name )

(string) name The name of the argument to retrieve

Returns the named argument from the query part of the URL.


(void) $url->import( $values )
(void) $urlQuery->import( $values)

(mixed) $values A list of name => value pairs to import into the query part of the URL. Can be either an array or a URL encoded string.

Imports each name => value pair into the query part of the URL. e.g.

$url = ar::url( '' );
$url->import( array( 'key1' => 'a value', 'key2' => 'value 2' ) );
echo $url;

Results in:


(void) $url->putvar( $name, $value )
(void) $urlQuery->putvar( $name, $value )

(string) $name The name ot the argument to set.
(mixed) $value The value for the argument.

Updates or inserts a named argument in the URL query.