HTTP(S) URI handler

category Zend
package Zend_Uri
uses
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Uri

 Methods

Return a string representation of this URI.

__toString() : string
Inherited
see

Returns

string

Add or replace params in the query string for the current URI, and return the old query.

addReplaceQueryParameters(array $queryParams) : string

Parameters

$queryParams

array

Returns

stringOld query string

Convenience function, checks that a $uri string is well-formed by validating it but not returning an object. Returns TRUE if $uri is a well-formed URI, or FALSE otherwise.

check(string $uri) : boolean
InheritedStatic

Parameters

$uri

string

The URI to check

Returns

boolean

Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.

factory(string $uri = 'http', string $className = null) : \Zend_Uri
InheritedStatic
link http://www.faqs.org/rfcs/rfc2396.html

Parameters

$uri

string

The URI form which a Zend_Uri instance is created

$className

string

The name of the class to use in order to manipulate URI

Exceptions

\Zend_Uri_Exception When an empty string was supplied for the scheme
\Zend_Uri_Exception When an illegal scheme is supplied
\Zend_Uri_Exception When the scheme is not supported
\Zend_Uri_Exception When $className doesn't exist or doesn't implements Zend_Uri

Returns

\Zend_Uri

Creates a Zend_Uri_Http from the given string

fromString(string $uri) : \Zend_Uri_Http
Static

Parameters

$uri

string

String to create URI from, must start with 'http://' or 'https://'

Exceptions

\InvalidArgumentException When the given $uri is not a string or does not start with http:// or https://
\Zend_Uri_Exception When the given $uri is invalid

Returns

\Zend_Uri_Http

Returns the fragment portion of the URL (after #), or FALSE if none.

getFragment() : string | false

Returns

stringfalse

Returns the domain or host IP portion of the URL, or FALSE if none.

getHost() : string

Returns

string

Returns the password portion of the URL, or FALSE if none.

getPassword() : string

Returns

string

Returns the path and filename portion of the URL.

getPath() : string

Returns

string

Returns the TCP port, or FALSE if none.

getPort() : string

Returns

string

Returns the query portion of the URL (after ?), or FALSE if none.

getQuery() : string

Returns

string

Returns the query portion of the URL (after ?) as a key-value-array. If the query is empty an empty array is returned

getQueryAsArray() : array

Returns

array

Get the URI's scheme

getScheme() : string | false
Inherited

Returns

stringfalseScheme or false if no scheme is set.

Returns a URI based on current values of the instance variables. If any part of the URI does not pass validation, then an exception is thrown.

getUri() : string
inherited_from \Zend_Uri::getUri()

Exceptions

\Zend_Uri_Exception When one or more parts of the URI are invalid

Returns

string

Return a string representation of this URI.

getUri() : string
Inherited

Returns

string

Returns the username portion of the URL, or FALSE if none.

getUsername() : string

Returns

string

Remove params in the query string for the current URI, and return the old query.

removeQueryParameters(array $queryParamKeys) : string

Parameters

$queryParamKeys

array

Returns

stringOld query string

Set global configuration options

setConfig(\Zend_Config|array $config) 
InheritedStatic

Parameters

$config

\Zend_Configarray

Sets the fragment for the current URI, and returns the old fragment

setFragment(string $fragment) : string

Parameters

$fragment

string

Fragment of the current URI

Exceptions

\Zend_Uri_Exception When $fragment is not a valid HTTP fragment

Returns

string

Sets the host for the current URI, and returns the old host

setHost(string $host) : string

Parameters

$host

string

The HTTP host

Exceptions

\Zend_Uri_Exception When $host is nota valid HTTP host

Returns

string

Sets the password for the current URI, and returns the old password

setPassword(string $password) : string

Parameters

$password

string

The HTTP password

Exceptions

\Zend_Uri_Exception When $password is not a valid HTTP password

Returns

string

Sets the path for the current URI, and returns the old path

setPath(string $path) : string

Parameters

$path

string

The HTTP path

Exceptions

\Zend_Uri_Exception When $path is not a valid HTTP path

Returns

string

Sets the port for the current URI, and returns the old port

setPort(string $port) : string

Parameters

$port

string

The HTTP port

Exceptions

\Zend_Uri_Exception When $port is not a valid HTTP port

Returns

string

Set the query string for the current URI, and return the old query string This method accepts both strings and arrays.

setQuery(string|array $query) : string

Parameters

$query

stringarray

The query string or array

Exceptions

\Zend_Uri_Exception When $query is not a valid query string

Returns

stringOld query string

Sets the username for the current URI, and returns the old username

setUsername(string $username) : string

Parameters

$username

string

The HTTP username

Exceptions

\Zend_Uri_Exception When $username is not a valid HTTP username

Returns

string

Validate the current URI from the instance variables. Returns true if and only if all parts pass validation.

valid() : boolean
inherited_from \Zend_Uri::valid()

Returns

boolean

Returns TRUE if this URI is valid, or FALSE otherwise.

valid() : boolean
Inherited

Returns

boolean

Returns true if and only if the fragment passes validation. If no fragment is passed, then the fragment contained in the instance variable is used.

validateFragment(string $fragment = null) : boolean
link http://www.faqs.org/rfcs/rfc2396.html

Parameters

$fragment

string

Fragment of an URI

Exceptions

\Zend_Uri_Exception When fragment validation fails

Returns

boolean

Returns true if and only if the host string passes validation. If no host is passed, then the host contained in the instance variable is used.

validateHost(string $host = null) : boolean
uses

Parameters

$host

string

The HTTP host

Returns

boolean

Returns true if and only if the password passes validation. If no password is passed, then the password contained in the instance variable is used.

validatePassword(string $password = null) : boolean
link http://www.faqs.org/rfcs/rfc2396.html

Parameters

$password

string

The HTTP password

Exceptions

\Zend_Uri_Exception When password validation fails

Returns

boolean

Returns true if and only if the path string passes validation. If no path is passed, then the path contained in the instance variable is used.

validatePath(string $path = null) : boolean

Parameters

$path

string

The HTTP path

Exceptions

\Zend_Uri_Exception When path validation fails

Returns

boolean

Returns true if and only if the TCP port string passes validation. If no port is passed, then the port contained in the instance variable is used.

validatePort(string $port = null) : boolean

Parameters

$port

string

The HTTP port

Returns

boolean

Returns true if and only if the query string passes validation. If no query is passed, then the query string contained in the instance variable is used.

validateQuery(string $query = null) : boolean
link http://www.faqs.org/rfcs/rfc2396.html

Parameters

$query

string

The query to validate

Exceptions

\Zend_Uri_Exception When query validation fails

Returns

boolean

Returns true if and only if the username passes validation. If no username is passed, then the username contained in the instance variable is used.

validateUsername(string $username = null) : boolean
link http://www.faqs.org/rfcs/rfc2396.html

Parameters

$username

string

The HTTP username

Exceptions

\Zend_Uri_Exception When username validation fails

Returns

boolean

Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI (e.g., example.com/path/to/resource?query=param#fragment)

__construct(string $scheme, string $schemeSpecific = ''

Use Zend_Uri::factory() to return a new Zend_Uri object.

inherited_from \Zend_Uri::__construct()

Parameters

$scheme

string

The scheme of the URI

$schemeSpecific

string

The scheme-specific part of the URI

Exceptions

\Zend_Uri_Exception When the URI is not valid

Zend_Uri and its subclasses cannot be instantiated directly.

__construct(string $scheme, string $schemeSpecific = ''
Inherited

Use Zend_Uri::factory() to return a new Zend_Uri object.

Parameters

$scheme

string

The scheme of the URI

$schemeSpecific

string

The scheme-specific part of the URI

Parse the scheme-specific portion of the URI and place its parts into instance variables.

_parseUri(string $schemeSpecific) : void

Parameters

$schemeSpecific

string

The scheme-specific portion to parse

Exceptions

\Zend_Uri_Exception When scheme-specific decoposition fails
\Zend_Uri_Exception When authority decomposition fails

 Properties

 

Global configuration array

$_config : array

Default

array('allow_unwise' => false)
Static
 

HTTP fragment

$_fragment : string

Default

''
 

HTTP host

$_host : string

Default

''
 

HTTP password

$_password : string

Default

''
 

HTTP part

$_path : string

Default

''
 

HTTP post

$_port : string

Default

''
 

HTTP query

$_query : string

Default

''
 

Regular expression grammar rules for validation; values added by constructor

$_regex : array

Default

array()
 

Scheme of this URI (http, ftp, etc.)

$_scheme : string

Default

''
 

HTTP username

$_username : string

Default

''

 Constants

 

Character classes for validation regular expressions

CHAR_ALNUM = 'A-Za-z0-9' 
 

CHAR_MARK

CHAR_MARK = '-_.!~*\'()\[\]' 
 

CHAR_RESERVED

CHAR_RESERVED = ';\/?:@&=+$,' 
 

CHAR_SEGMENT

CHAR_SEGMENT = ':@&=+$,;' 
 

CHAR_UNWISE

CHAR_UNWISE = '{}|\\\\^`'