Overview

Namespaces

  • esperecyan
    • url
      • lib

Classes

  • URL
  • URLSearchParams
  • Overview
  • Namespace
  • Class
  • Tree

Class URL

The URL class represent an object providing static methods used for creating object URLs.

esperecyan\url\URL implements JsonSerializable
Namespace: esperecyan\url
Link: URL Standard
Link: URL - Web API Interfaces | MDN
Located at URL.php
Methods summary
public
# __construct( string $url, string $base = null )

The constructor returns a newly created URL object representing the URL defined by the parameters.

The constructor returns a newly created URL object representing the URL defined by the parameters.

Parameters

$url

Is a DOMString representing an absolute or relative URL. If $url is a relative URL, $base which is present, will be used as the base URL. If $url is an absolute URL, $base are ignored.

$base

Is a DOMString representing the base URL to use in case $url is a relative URL. If not specified, and no $base is passed in parameters, it default to 'about:blank'.

Throws

esperecyan\webidl\TypeError
If the given base URL or the resulting URL are not valid URLs, a TypeError is thrown.

Link

URL Standard
URL() - Web API Interfaces | MDN
public static string
# domainToASCII( string $domain )

Converts domain name to IDNA ASCII form.

Converts domain name to IDNA ASCII form.

Deprecated

5.0.0 URL::domainToASCII() has been removed from the URL Standard specification.

Parameters

$domain

Returns

string
Returns an empty string if $domain is an IPv6 address or an invalid domain.

See

\esperecyan\url\lib\HostProcessing::domainToASCII()

Link

Remove URL.domainToASCII and domainToUnicode · whatwg/url@2bd0f59y
public static string
# domainToUnicode( string $domain )

Converts domain name from IDNA ASCII to Unicode.

Converts domain name from IDNA ASCII to Unicode.

Deprecated

5.0.0 URL::domainToUnicode() has been removed from the URL Standard specification.

Parameters

$domain

Returns

string
Returns an empty string if $domain is an IPv6 address or an invalid domain.

See

\esperecyan\url\lib\HostProcessing::domainToUnicode()

Link

Remove URL.domainToASCII and domainToUnicode · whatwg/url@2bd0f59y
public
# __set( string $name, string $value )

Parameters

$name
$value

Throws

esperecyan\webidl\TypeError
public string|esperecyan\url\URLSearchParams
# __get( string $name )

Parameters

$name

Returns

string|esperecyan\url\URLSearchParams
public string
# __toString( )

Returns a USVString containing the whole URL. It is a synonym for URL::$href.

Returns a USVString containing the whole URL. It is a synonym for URL::$href.

Returns

string
USVString.

Link

URL Standard
public string
# jsonSerialize( )

Returns the href property value.

Returns the href property value.

The URL Standard defines the URL::toJSON() method as to return data which should be serialized to JSON for the JSON::stringify() method on ECMAScript. However, in PHP, a toJSON() method is often defined as to return JSON string, for example the Zend\Json\Json::encode() and the lluminate\Contracts\Support\Jsonable::toJson() method.

Returns

string
USVString.

Link

URL Standard

Implementation of

JsonSerializable::jsonSerialize()
public boolean
# __isset( string $name )

Parameters

$name

Returns

boolean
Magic properties summary
public string $href

Is a USVString containing the whole URL.

public string $protocol

Is a USVString containing the protocol scheme of the URL, including the final ‘:’.

public string $username

Is a USVString containing the username specified before the domain name.

public string $password

Is a USVString containing the password specified before the domain name.

public string $host

Is a USVString containing the host, that is the hostname, and then, if the port of the URL is not empty (which can happen because it was not specified or because it was specified to be the default port of the URL’s scheme), a ‘:’, and the port of the URL.

public string $hostname

Is a USVString containing the domain of the URL.

public string $port

Is a USVString containing the port number of the URL.

public string $pathname

Is a USVString containing an initial ‘/’ followed by the path of the URL.

public string $search

Is a USVString containing a ‘?’ followed by the parameters of the URL.

public string $hash

Is a USVString containing a ‘#’ followed by the fragment identifier of the URL.

public read-only string $origin

Returns a USVString containing the canonical form of the origin of the specific location.

public read-only esperecyan\url\URLSearchParams $searchParams

Returns a URLSearchParams object allowing to access the GET query arguments contained in the URL.

esperecyan/url documentation API documentation generated by ApiGen