The Phalcon\Http\Message\Uri returns a value object representing a URI. The object represents a URI as defined in RFC 3986, providing methods for the most common operations. The primary use of this component is for HTTP requests but can be used in other contexts.
The Uri object created is immutable, meaning it will never change. Any call to methods prefixed with with* will return a clone of the object to maintain immutability, as per the standard.
The constructor accepts an optional string, representing the URI. If specified, the URI will be processed and split into the necessary parts internally.
Returns the string representation of the URI. Depending on which components of the URI are present, the resulting string is either a full URI or relative reference according to RFC 3986, Section 4.1. The method concatenates the various components of the URI.
Returns a string representing the path component of the URI. The path can either be empty or absolute (starting with a slash) or rootless (not starting with a slash). Normally, the empty path “” and absolute path / are considered equal but this method will not do this normalization automatically. The value returned is percent-encoded.
Returns an integer representing the port component of the URI. If the port is present and it is non-standard for the current scheme, it will be returned. If however it is a standard port for the specified scheme, null will be returned. Additionally, if no port is present and no scheme is present then null is returned.
Returns a string representation of the user information of the URI. If no user information is present, an empty string is returned. If both user and password are present, they will be returned together concatenated with a colon (:) separating the values.