🚀 Vision – Natural Data Engine NDE • PHP 8.3+
⚡ Zero Configuration (Plug & Play)
Unlike SQL (MySQL) or NoSQL (MongoDB), Vision requires no server installation, no user account, and no setup.
Including vision.php in your code instantly activates
the entire engine (Database, Cache, Locks, Worker).
Vision is a Natural Data Engine (NDE).
An NDE is an evolution of traditional databases: it stores, reads and links data like a classic DB, but without schema, without tables, without SQL and without imposed structure.
Vision relies on two simple foundations: UniCell, where each data point is an autonomous cell stored in a .vr file, and Wave, a minimal global state that coordinates the engine.
1. Introduction
Vision is a handcrafted data engine in PHP 8.3+, UTF‑8 LF, zero dependencies. It is autonomous, stable, and predictable. It naturally reconstructs complex structures: forums, CMS, knowledge graphs, presentations, etc.
- UniCell – each piece of data is an autonomous cell stored in a
.vrfile. Relations use simple levels:- 0 = lateral
- 1 = direct internal
- 2 = deep internal
- 3+ = rare cases
- Wave – a minimal global state, updated continuously (RAM, CPU, Disk, Locks).
• Smart RAM: Purgue at 75%, reactivate at 50% usage.
2. File Architecture
/vision/
vision.php → entry point (loads all modules)
Vision_UniCell.php → UniCell storage (.vr) + sharding
Vision_API.php → full Vision API
vision_wave.php → Wave global state
vision_lock.php → non-blocking global lock
vision_worker.php → async multitasking (Fibers)
vision_autoclean.php → autonomous maintenance
/data/
YYYYMMDD/
id_unique.vr → 1 file = 1 cell
3. UniCell – .vr Format
Each cell is stored in a .vr file:
VISION1
⟪¦<base64(json)>¦⟫
⟪Σ¦<crc32_checksum>¦⟫
⟪⇒¦⇐⟫
Internal JSON structure:
{
"id": "20260416_ab12cd34ef56",
"data": {...},
"relations": [
{"id": "xxx", "niveau": 1},
{"id": "yyy", "niveau": 0}
],
"createdAt": 1713200000,
"updatedAt": 1713200000
}
- Strict atomicity:
.tmp → flush → fsync → rename() - External CRC checksum (Instant verification before JSON decoding)
- Crash-safe with final marker validation
- Deterministic UTF‑8 format
4. Sharding
Each cell is stored based on its creation date:
/vision/data/YYYYMMDD/id.vrThe ID prefix (YYYYMMDD) automatically routes the data to its shard folder, preventing Linux filesystem slowdowns on large datasets.
5. Internal Modules
vision.php
- Zero-config entry point
- Silent logging (vision.log)
- Memory monitoring
Vision_UniCell.php
- Storage management
- Atomic I/O
- L1 RAM Cache
Vision_API.php
- Full public API
- Graph traversal
- Async search
vision_worker.php
- Async Fibers scheduler
- Non-blocking tasks
- Concurrency manager
6. Vision API (Reference)
| Method | Description |
|---|---|
| create | Create a new cell with unique ID |
| read | Load cell data (L1 Cache-first) |
| update | Modify existing data (Atomic) |
| delete | Permanently erase a cell |
| link | Create a relation between two cells |
| graph | Build a relation graph (depth max: 16) |
| find | Search using Generator (yield) |
7. Tutorial: Build a micro news system
This guide shows you how to manage articles and categories with Vision in just a few lines of code.
<?php
// 1. ACTIVATION (Zero Config)
// Just including this file initializes the DB and Cache.
include "vision/vision.php";
// 2. CREATE A CATEGORY
// Vision returns a unique ID (e.g., 20240522_abcdef123456).
$catId = Vision_API::create(['name' => 'Technology', 'color' => 'blue']);
echo "Category created: $catId \n";
// 3. CREATE A LINKED ARTICLE
// We link the article to the category using a niveau 1 (direct).
$newsId = Vision_API::create(
[
'title' => 'Vision v18 in Production',
'body' => 'The tutorial is finally here!',
'views' => 0
],
[['id' => $catId, 'niveau' => 1]]
);
echo "Article created: $newsId \n";
// 4. READ AND UPDATE
// Read the data, increment views, and save it back.
$article = Vision_API::read($newsId);
$article['data']['views']++;
Vision_API::update($newsId, $article['data']);
// 5. SEARCH (Find)
// Search for articles with more than 0 views.
// The Generator (yield) ensures zero RAM overhead.
$popular = Vision_API::find(fn($cell) =>
($cell['data']['views'] ?? 0) > 0
);
foreach($popular as $item) {
echo "Trending: " . $item['data']['title'] . "\n";
}
// 6. EXPLORE THE GRAPH
// Get the article and its linked category in one call.
$graph = Vision_API::graph($newsId);
print_r($graph);
// 7. STATISTICS
$stats = Vision_API::stats();
echo "Total records: " . $stats['count'];
8. Conclusion
Vision is a natural, simple, and predictable data engine. It provides universality through UniCells and coherence through Wave global state. It's built for developers who want full control without the overhead of traditional DB servers.