The url library provides useful methods for validating and parsing urls.


Returns true or false depending on whether the passed string is a valid http URL.

$this->zajlib->url->valid($url, $allow_spaces = true)

@param string $url The url to be parsed
@param boolean $allow_spaces Allow spaces in query string. This will allow spaces in query string, but also in the url. True url-encoded strings should not require this since spaces are %20.
@return bool True if a valid url. False otherwise.


Returns the domain without any subdomains for the given url. For example, for foo.bar.www.youtube.com it will return youtube.com.


@param string $url The url to parse.
@return string The domain portion of the url.


Returns the subdomain, but excludes www. This is useful because users usually think www.news.domain.com is the same as news.domain.com and domain.com is the same as www.domain.com.


@param string $url The url to parse.
@return string The subdomain portion of the url.


Generates a friendly url based on an input string.


@param string $title Any string such as a name or title.
@return string The string converted to a url-friendly format (no accents, trimmed, no spaces)


Get ready for query string by adding a ? or & to the url.


@param string $url Any url.
@return string Will return a url that is definitely ready to append a query string.

Outlast Web & Mobile Development (c) 2023 | Privacy Policy |