---
title: "Standard Library"
description: "Overview of all built-in static classes and practical usage patterns."
canonical_url: "https://www.zeyos.com/zymba/zymba-guide/standard-library"
markdown_url: "https://www.zeyos.com/ai/guide/zymba/zymba-guide/standard-library.md"
section: "zymba-guide"
authority: "draft-guide"
language: "en"
source_repository: "zeyos/guide"
source_path: "docs/zymba/07-standard-library/index.md"
source_revision: "cce886a8da98cd124ee3644711085bbdcf1a87ce"
---

# Standard Library

Zymba provides a rich set of built-in static classes accessed with the `@` prefix. This chapter covers every built-in class with verified examples.

## Class overview

| Class | Methods | Purpose |
|-------|---------|---------|
| `@String` | 96 | String manipulation — trim, replace, split, case, search |
| `@Regex` | 11 | Regular expression testing, matching, and replacing |
| `@Math` | 62 | Mathematical functions — trig, log, rounding, random |
| `@Number` | 42 | Number formatting, type checks, base conversion, rounding |
| `@Statistic` | 29 | Statistical analysis — mean, median, mode, variance |
| `@Date` | 31 | Date/time — now, format, parse, components, timezone |
| `@Var` | 30 | JSON/PHP serialization, type inspection, cloning |
| `@URI` | 20 | URL encoding/decoding, query strings, parsing |
| `@MIME` | 12 | Base64 and MIME encoding |
| `@ZLIB` | 6 | Compression: deflate, inflate, gzip |
| `@XML` | 5 | XML parsing and generation |
| `@IO` | 61 | File, directory, and stream operations |
| `@HTTP` | 42 | HTTP client/server — requests, headers, cookies |
| `@DNS` | 7 | DNS resolution and validation |
| `@Path` | 15 | File path manipulation |
| `@System` | 8 | System info: host, PID, memory usage |
| `@Console` | 7 | Logging and debug output |
| `@Output` | 6 | Output buffering control |
| `@Crypt` | 22 | Hashing, encryption, JWT, UUID generation |
| `@Exception` | — | Exception creation and stack traces |
| `@Function` | 7 | Function introspection and reflection |
| `@Array` | 97 | Array manipulation (covered in [Arrays and Collections](https://www.zeyos.com/zymba/zymba-guide/arrays-collections)) |
| `@SQL` | 4 | SQL query preparation (covered in [Platform Integration](https://www.zeyos.com/zymba/zymba-guide/platform-integration)) |
| `@ZeyOS` | 16 | Platform integration (covered in [Platform Integration](https://www.zeyos.com/zymba/zymba-guide/platform-integration)) |

## Practical patterns

### JSON API response handler

```zymba
function $apiRequest($url, $method = "GET", $data = null) {
    $headers = ["Content-Type": "application/json"];
    $body    = ($data is null) ? null : @Var.toJSON($data);

    try {
        $response = @HTTP.requestBody($url, $method, $body, $headers);
        return @Var.fromJSON($response);
    } catch ($e) {
        return [error: $e.getMessage()];
    }
}
```

### Data validation pipeline

```zymba
function $validateEmail($email) {
    $email = @String.trim($email);
    if (@String.isEmpty($email)) {
        return "Email is required";
    }
    if (!@Regex.test($email, "/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/")) {
        return "Invalid email format";
    }
    return null;
}
```

### Date range calculation

```zymba
$startOfMonth = @Date.create(1, @Date.getMonth(), @Date.getYear());
$endOfMonth   = @Date.create(
    @Date.getDaysInMonth(),
    @Date.getMonth(),
    @Date.getYear(),
    23, 59, 59
);

$formattedRange = @Date.format("Y-m-d", $startOfMonth)
    . " to "
    . @Date.format("Y-m-d", $endOfMonth);
```

### See also

- [Strings](https://www.zeyos.com/zymba/zymba-guide/standard-library/strings) — `@String`, `@Regex`
- [Math and Numbers](https://www.zeyos.com/zymba/zymba-guide/standard-library/math-numbers) — `@Math`, `@Number`, `@Statistic`
- [Dates](https://www.zeyos.com/zymba/zymba-guide/standard-library/dates) — `@Date`
- [Encoding and Data](https://www.zeyos.com/zymba/zymba-guide/standard-library/encoding-data) — `@Var`, `@URI`, `@MIME`, `@ZLIB`, `@XML`
- [IO and HTTP](https://www.zeyos.com/zymba/zymba-guide/standard-library/io-http) — `@IO`, `@HTTP`, `@DNS`, `@Path`, `@System`, `@Console`, `@Output`
- [Security](https://www.zeyos.com/zymba/zymba-guide/standard-library/security) — `@Crypt`, `@Exception`
