Back to Home

LOTIS PHP framework: objects instead of DOM and asynchronous calls

Analysis of the LOTIS framework architecture, built over 10 years of development. Describes the CMA (Construct-Metadata-Assembly) principle, replacing DOM and asynchronous calls with an object model. Code examples from a real application and advantages of the approach for business tasks.

LOTIS: PHP without DOM and Promise — how does it work?
Advertisement 728x90

LOTIS: PHP Framework Replacing DOM and Async Calls with Objects

After ten years of development, the LOTIS framework's author arrived at a radical solution: ditching tags and async requests in favor of an object-oriented approach. The result? Building web apps as a unified whole, without splitting client from server. Developers work with domain objects instead of DOM elements, slashing the time needed to implement business logic.

CMA Concept: From Objects to Metadata

The foundation of LOTIS architecture is the CMA principle (Construct-Metadata-Assembly). Apps are built entirely from objects implementing the base Construct interface. Each object generates metadata used for building interfaces, enabling reactivity, or creating APIs. The key component is the Space class, which assembles the web app from these objects.

Unlike traditional frameworks that separate markup from logic, LOTIS lets you:

Google AdInline article slot
  • Describe UI through PHP objects
  • Use the same variables on both client and server
  • Skip manual async operation handling
  • Dynamically alter component hierarchies via inheritance

A minimal working example shows the essence:

$div = LTS::Div()->capt("Hello from LOTIS!");
LTS::Space()->build($div);

Here, LTS::Div() creates an object, not an HTML tag. DOM conversion happens only when passing the object to Space. This lets you manipulate app structure with the freedom of classic desktop frameworks.

Real-World Case: "Tracker" Accounting System

Consider this code snippet from a working app for inventory tracking and payroll calculations. LOTIS describes complex logic compactly, without templates or AJAX calls:

Google AdInline article slot
$maindiv = LTS::DataView();
$maindiv->bindtodb($kassa, [
    'head' => ['sel' => '', 'date' => 'Date'],
    'inputs' => [
        ['name' => 'id',  'type' => 'hidden'],
        ['name' => 'date', 'type' => 'date', 'caption' => 'Date'],
        ['name' => 'save', 'caption' => 'Write', 'type' => 'button'],
        ['name' => 'close', 'caption' => 'Cancel', 'type' => 'button']
    ],
    'cells' => ['save, close', 'date']
]);

$subtable = $maindiv->subtable('kassasubtable', $kassatable, [
    'head' => [
        'sel' => '',
        'name' => 'Employee',
        'pay' => 'Received',
        'del' => ''
    ],
    'inputs' => [
        ['name' => 'user', 'type' => 'table', 'dbtable' => $users, 'caption' => 'Employee'],
        ['name' => 'message', 'caption' => 'Onwartość'],
        ['name' => 'pay', 'type' => 'numeric', 'caption' => 'Issued']
    ]
]);

$maindiv->onsave(function ($args, $result) {
    global $money, $users;
    $paytable = $args['subtables']['kassasubtable'];
    $stock = LTS::Stock($money);
    $stock->collector($users, 'user', ['total' => 'pay']);
    $stock->update(['doc' => $result['data']['id']], $paytable);
    return $result;
});

Notice the document save handling: business logic (like payroll accrual) is captured in one block, with no client-server split. JavaScript hooks integrate via methods like table->out(), without needing async pattern expertise.

Advantages for Developers

LOTIS tackles three core issues in traditional web development:

  • Eliminating logic duplication — data checks and transformations are defined once in objects, not scattered across JS and PHP modules
  • Reducing architecture complexity — no need to design APIs or manage loading states
  • Unified data model — object changes auto-sync between client and server via metadata

It's especially valuable for tight-deadline projects: standard ops (forms, tables, validation) take 3-5 lines instead of dozens. Flexibility remains — JS hooks let you customize anything, like this date formatting:

Google AdInline article slot
$maindiv->table->out(<<<JS
function (row, obj) {
    row.find('td.Column_date').text(obj.date.substr(0, 10));
}
JS);

Key Points

  • LOTIS blurs the client-server line with an object model that generates metadata
  • Development uses pure PHP, no templates, but JS logic can be embedded
  • Saves time on routine tasks: AJAX, validation, state sync
  • CMA lets the same objects serve UI, API, or offline mode
  • Node.js port enables PWAs and local apps with sync

The current implementation targets business apps where speed is key. The next major version adds TypeScript support and better integration with modern build tools. For devs fed up with DOM wrappers and Promise chains, LOTIS brings back OOP simplicity without sacrificing web capabilities.

— Editorial Team

Advertisement 728x90

Read Next