---
title: "URI"
description: "Static URI related functions."
canonical_url: "https://www.zeyos.com/zymba/ref/uri"
markdown_url: "https://www.zeyos.com/ai/guide/zymba/ref/uri.md"
section: "zymba-reference"
authority: "reference"
language: "en"
source_repository: "https://cloud.zeyos.com/__doc/zymbaref.json"
source_sha256: "05a361c6ddc32e74f4a6dc16fd06f218210ff1b7ce57f26ca1994bfffc407915"
---

# URI

## URI

```
object @URI() {
	createDataURI(string $string, string $type, string $charset): string {}
	createQuery(object $attributes): string {}
	decode(string $string): string {}
	encode(string $string): string {}
	getAuthority(string $uri): string {}
	getFragment(string $uri): string {}
	getHierarchy(string $uri): string {}
	getHost(string $uri): string {}
	getPassword(string $uri): string {}
	getPath(string $uri): string {}
	getPort(string $uri): string {}
	getQuery(string $uri): string {}
	getScheme(string $uri): string {}
	getUser(string $uri): string {}
	isAbsolute(string $uri): bool {}
	isFile(string $path): bool {}
	isValid(string $uri): bool {}
	normalize(string $uri): string {}
	parse(string $uri): object {}
	parseQuery(string $query): object {}
}
```

**Static URI related functions.**

## Functions


### `@URI.createDataURI()`


Creates a data URI according to RFC 2397.

```code
@URI.createDataURI(string $string, string $type, string $charset): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |
| type | `string`  |  | "text/plain" |
| charset | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.createQuery()`


Creates the URI query component out of specific attribute name and value pairs according to RFC 3986.

```code
@URI.createQuery(object $attributes): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| attributes | `object`  | [name: value, ...] | [] |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.decode()`


Decodes a string according to RFC 3986 by replacing sequences incipient with a percent sign ("%") followed by a 2-character hexadecimal number with their applicable characters.

```code
@URI.decode(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.encode()`


Encodes a string according to RFC 3986 by replacing non-alphanumeric characters except "-", "_", "." and "~" with a percent sign ("%") followed by a 2-character hexadecimal number.

```code
@URI.encode(string $string): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| string | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getAuthority()`


Gets the authority component of an URI.

```code
@URI.getAuthority(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getFragment()`


Gets the fragment component of an URI.

```code
@URI.getFragment(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getHierarchy()`


Gets the hierarchy component of an URI.

```code
@URI.getHierarchy(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getHost()`


Gets the host name component of an URI.

```code
@URI.getHost(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getPassword()`


Gets the password component of an URI.

```code
@URI.getPassword(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getPath()`


Gets the path name component of an URI.

```code
@URI.getPath(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getPort()`


Gets the port number component of an URI.

```code
@URI.getPort(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getQuery()`


Gets the query component of an URI.

```code
@URI.getQuery(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getScheme()`


Gets the scheme component of an URI.

```code
@URI.getScheme(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.getUser()`


Gets the username component of an URI.

```code
@URI.getUser(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.isAbsolute()`


Determines whether an URI is absolute, meaning it has a scheme component.

```code
@URI.isAbsolute(string $uri): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@URI.isFile()`


Determines whether an URI is of the file URI scheme.

```code
@URI.isFile(string $path): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| path | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@URI.isValid()`


Determines whether an URI is valid.

```code
@URI.isValid(string $uri): bool
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `bool` |  |




### `@URI.normalize()`


Normalizes an URI to its canonicalized representation according to RFC 3986 and the comparison rules of RFC 2616.

```code
@URI.normalize(string $uri): string
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `string` |  |




### `@URI.parse()`


```code
@URI.parse(string $uri): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| uri | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | ["scheme": ..., "user": ..., "password": ..., "host": ..., "port": ..., "path": ..., "query": ..., "fragment": ...] |




### `@URI.parseQuery()`


```code
@URI.parseQuery(string $query): object
```

##### Parameters

| Name | Type | Value | Default |
| --- | --- | --- | --- |
| query | `string`  |  | "" |

##### Returns

| Type | Value |
| --- | ---  |
| `object` | [name: value, ...] |
