Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Context
  • FileUpload
  • Helpers
  • Request
  • RequestFactory
  • Response
  • Session
  • SessionSection
  • Url
  • UrlScript
  • UserStorage

Interfaces

  • IRequest
  • IResponse
  • ISessionStorage
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class Url

URI Syntax (RFC 3986).

scheme  user  password  host  port  basePath   relativeUrl
  |      |      |        |      |    |             |
/--\   /--\ /------\ /-------\ /--\/--\/----------------------------\
http://john:x0y17575@nette.org:8042/en/manual.php?name=param#fragment  <-- absoluteUrl
       \__________________________/\____________/^\________/^\______/
                    |                     |           |         |
                authority               path        query    fragment
  • authority: [user[:password]@]host[:port]
  • hostUrl: http://user:password@nette.org:8042
  • basePath: /en/ (everything before relative URI not including the script name)
  • baseUrl: http://user:password@nette.org:8042/en/
  • relativeUrl: manual.php
Nette\Http\Url implements JsonSerializable uses Nette\SmartObject

Direct known subclasses

Nette\Http\UrlScript
Namespace: Nette\Http
Located at Http/Url.php
Methods summary
public
# __construct( string|Nette\Http\Url $url = null )

Parameters

$url

Throws

Nette\InvalidArgumentException
if URL is malformed
public Nette\Http\Url
# setScheme( string $value )

Sets the scheme part of URI.

Sets the scheme part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getScheme( )

Returns the scheme part of URI.

Returns the scheme part of URI.

Returns

string
string
public Nette\Http\Url
# setUser( string $value )

Sets the user name part of URI.

Sets the user name part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getUser( )

Returns the user name part of URI.

Returns the user name part of URI.

Returns

string
string
public Nette\Http\Url
# setPassword( string $value )

Sets the password part of URI.

Sets the password part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getPassword( )

Returns the password part of URI.

Returns the password part of URI.

Returns

string
string
public Nette\Http\Url
# setHost( string $value )

Sets the host part of URI.

Sets the host part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getHost( )

Returns the host part of URI.

Returns the host part of URI.

Returns

string
string
public string
# getDomain( $level = 2 )

Returns the part of domain.

Returns the part of domain.

Returns

string
string
public Nette\Http\Url
# setPort( integer $value )

Sets the port part of URI.

Sets the port part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public integer|null
# getPort( )

Returns the port part of URI.

Returns the port part of URI.

Returns

integer|null
int|null
public Nette\Http\Url
# setPath( string $value )

Sets the path part of URI.

Sets the path part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getPath( )

Returns the path part of URI.

Returns the path part of URI.

Returns

string
string
public Nette\Http\Url
# setQuery( string|array $value )

Sets the query part of URI.

Sets the query part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public Nette\Http\Url
# appendQuery( string|array $value )

Appends the query part of URI.

Appends the query part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getQuery( )

Returns the query part of URI.

Returns the query part of URI.

Returns

string
string
public array
# getQueryParameters( )

Returns

array
array
public mixed
# getQueryParameter( string $name, mixed $default = null )

Parameters

$name
$default

Returns

mixed
mixed
public Nette\Http\Url
# setQueryParameter( string $name, mixed $value )

Parameters

$name
$value
unsets the parameter

Returns

Nette\Http\Url
static
public Nette\Http\Url
# setFragment( string $value )

Sets the fragment part of URI.

Sets the fragment part of URI.

Parameters

$value

Returns

Nette\Http\Url
static
public string
# getFragment( )

Returns the fragment part of URI.

Returns the fragment part of URI.

Returns

string
string
public string
# getAbsoluteUrl( )

Returns the entire URI including query string and fragment.

Returns the entire URI including query string and fragment.

Returns

string
string
public string
# getAuthority( )

Returns the [user[:pass]@]host[:port] part of URI.

Returns the [user[:pass]@]host[:port] part of URI.

Returns

string
string
public string
# getHostUrl( )

Returns the scheme and authority part of URI.

Returns the scheme and authority part of URI.

Returns

string
string
public string
# getBasePath( )

Returns the base-path.

Returns the base-path.

Returns

string
string
public string
# getBaseUrl( )

Returns the base-URI.

Returns the base-URI.

Returns

string
string
public string
# getRelativeUrl( )

Returns the relative-URI.

Returns the relative-URI.

Returns

string
string
public boolean
# isEqual( string|Nette\Http\Url $url )

URL comparison.

URL comparison.

Parameters

$url

Returns

boolean
bool
public Nette\Http\Url
# canonicalize( )

Transforms URL to canonical form.

Transforms URL to canonical form.

Returns

Nette\Http\Url
static
public string
# __toString( )

Returns

string
string
public string
# jsonSerialize( )

Returns

string
string

Implementation of

JsonSerializable::jsonSerialize()
public static string
# unescape( string $s, string $reserved = '%;/?:@&=+$,' )

Similar to rawurldecode, but preserves reserved chars encoded.

Similar to rawurldecode, but preserves reserved chars encoded.

Parameters

$s
decode
$reserved
characters

Returns

string
string
public static array
# parseQuery( $s )

Parses query string.

Parses query string.

Returns

array
array
Methods used from Nette\SmartObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Properties summary
public static array $defaultPorts
#[ 'http' => 80, 'https' => 443, 'ftp' => 21, 'news' => 119, 'nntp' => 119, ]
Magic properties summary
public string $scheme
public string $user
public string $password
public string $host
public integer $port
public string $path
public string $query
public string $fragment
public read-only string $absoluteUrl
public read-only string $authority
public read-only string $hostUrl
public read-only string $basePath
public read-only string $baseUrl
public read-only string $relativeUrl
public read-only array $queryParameters
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0