Zum Hauptinhalt springen

Introduction

Zymba is a scripting language designed for the ZeyOS enterprise platform. It provides a modern, C-family syntax for building business logic, API integrations, data processing workflows, and automation within ZeyOS.

Unlike iXML — ZeyOS's XML-based templating language — Zymba uses familiar curly-brace syntax that feels natural to developers coming from JavaScript, PHP, or any C-family language. Both languages share the same ZeyOS platform APIs and database access, but each has a distinct strength: Zymba excels at logic-heavy code, while iXML is better suited for document generation and templating.

Language characteristics

C-family syntax

Zymba uses curly braces for blocks, semicolons to end statements, and familiar control flow:

ZYMBA
if ($price > 100) {
$discount = $price * 0.1;
}

for ($items as $item) {
$total += $item.price;
}

Dollar-prefix variables

All variables use the $ prefix, similar to PHP:

ZYMBA
$name = "Alice";
$count = 42;
$items = [1, 2, 3];

Static class system

Built-in utilities are accessed through @Class.method() syntax:

ZYMBA
$trimmed = @String.trim($input);
$hash = @Crypt.hash($password, "sha256");
$json = @Var.toJSON($data);
$uuid = @Crypt.createUUID();

Dot operator for string concatenation

Zymba uses . for string concatenation while + always performs numeric addition:

ZYMBA
$greeting = "Hello, " . $name . "!"; // String concatenation
$sum = 5 + 10; // Always numeric: 15

Dynamic typing with first-class functions

Variables hold any type and functions are values:

ZYMBA
$double = function($x) { return $x * 2; };
$result = @Array.map([1, 2, 3], $double);
// [2, 4, 6]

When to use Zymba

Zymba is the primary choice for:

  • API integrations — HTTP clients, webhook handlers, data synchronization
  • Data processing — CSV/JSON import/export, batch transformations
  • Business logic — price calculations, order workflows, validation rules
  • Scheduled tasks — cron jobs, cleanup routines, report generation
  • Service endpoints — REST API handlers with remotecall services

Zymba vs iXML

ZeyOS supports two languages. Choose based on the task:

AspectZymbaiXML
SyntaxC-family (curly braces, semicolons)XML-based (tags and attributes)
Best forLogic-heavy code, APIs, data processingPDF generation, templates, form layouts
String concat. operator$variable substitution in content
Learning curveFamiliar to JS/PHP developersUnique XML-based approach
File extension.zy.ixml or embedded in XML

Both languages have access to the same ZeyOS platform APIs and database.

Platform integration

Zymba integrates directly with ZeyOS through built-in classes:

  • @ZeyOS — database access, entity management, configuration
  • @SQL — query preparation and parameterization
  • @HTTP — incoming request handling and outgoing HTTP calls
  • @IO — file system operations
  • @APPSETTINGS — application configuration

Application file structure

Zymba files use the .zy extension and live in ZeyOS application directories:

Text
my-app/
├── services/
│ ├── api-handler.zy # remotecall endpoint
│ ├── daily-sync.zy # timing job
│ └── after-order.zy # entity hook
├── resources/
│ ├── lib.zy # shared library
│ └── helpers.zy # utility functions
└── zeyos.app.json # app manifest

Module system

Import standard library modules with include:

ZYMBA
include 'zymba:date,sql,var,string';

Common modules: date, sql, var, string, crypt, http, math, io.

Import shared application resources:

ZYMBA
include 'resource:lib'; // Loads resources/lib.zy
include 'resource:helpers'; // Loads resources/helpers.zy

See also