{"id":35664041,"url":"https://github.com/wowoengine/sawitdb-php","last_synced_at":"2026-01-13T23:02:39.062Z","repository":{"id":331576766,"uuid":"1128353255","full_name":"WowoEngine/SawitDB-PHP","owner":"WowoEngine","description":"SawitDB: The First Agricultural-Based Database with Anti-Corruption Protocols. Built for Data Sovereignty to oppose expensive, unreliable state infrastructure.","archived":false,"fork":false,"pushed_at":"2026-01-10T05:59:49.000Z","size":68,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T01:44:46.409Z","etag":null,"topics":["database","database-engine","php","sawit-db","sawitdb","wowo-engine","wowoengine"],"latest_commit_sha":null,"homepage":"https://kitabisa.com/campaign/donasipedulibanjiraceh","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WowoEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-05T14:10:14.000Z","updated_at":"2026-01-10T05:59:53.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/WowoEngine/SawitDB-PHP","commit_stats":null,"previous_names":["wowoengine/sawitdb-php"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/WowoEngine/SawitDB-PHP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WowoEngine%2FSawitDB-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WowoEngine%2FSawitDB-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WowoEngine%2FSawitDB-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WowoEngine%2FSawitDB-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WowoEngine","download_url":"https://codeload.github.com/WowoEngine/SawitDB-PHP/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WowoEngine%2FSawitDB-PHP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-engine","php","sawit-db","sawitdb","wowo-engine","wowoengine"],"created_at":"2026-01-05T17:16:08.219Z","updated_at":"2026-01-13T23:02:39.055Z","avatar_url":"https://github.com/WowoEngine.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SawitDB (PHP Version)\n\n![SawitDB Banner](https://github.com/WowoEngine/SawitDB/raw/main/docs/sawitdb.jpg)\n\n\u003cdiv align=\"center\"\u003e\n\n[![Docs](https://img.shields.io/badge/Docs-Read%20Now-blue?style=for-the-badge\u0026logo=googledocs)](https://wowoengine.github.io/SawitDB/)\n[![Packagist](https://img.shields.io/packagist/v/wowoengine/sawitdb-php?style=for-the-badge\u0026logo=packagist)](https://packagist.org/packages/wowoengine/sawitdb-php)\n[![Node.js Version](https://img.shields.io/badge/Node.js%20Version-Visit%20Repo-green?style=for-the-badge\u0026logo=nodedotjs)](https://github.com/WowoEngine/SawitDB)\n[![Go Version](https://img.shields.io/badge/Go%20Version-Visit%20Repo-cyan?style=for-the-badge\u0026logo=go)](https://github.com/WowoEngine/SawitDB-Go)\n\n\u003c/div\u003e\n\n**SawitDB** is a unique database solution stored in `.sawit` binary files.\n\nThe system features a custom **Paged Heap File** architecture similar to SQLite, using fixed-size 4KB pages to ensure efficient memory usage. What differentiates SawitDB is its unique **Agricultural Query Language (AQL)**, which replaces standard SQL keywords with Indonesian farming terminology.\n\n**Now availability on Packagist!**\n\n**🚨 Emergency: Aceh Flood Relief**\nPlease support our brothers and sisters in Aceh.\n\n[![Kitabisa](https://img.shields.io/badge/Kitabisa-Bantu%20Aceh-blue?style=flat\u0026logo=heart)](https://kitabisa.com/campaign/donasipedulibanjiraceh)\n\n*Organized by Human Initiative Aceh*\n\n## Features\n\n- **Paged Architecture**: Data is stored in 4096-byte binary pages.\n- **Object Caching (New)**: Implements Page-Level Object Caching for high-speed reads (bypassing JSON parse for hot pages).\n- **Hash Joins (New)**: Optimized `JOIN` operations (O(M+N)) for massive performance gains on relations.\n- **Persistent Indexes (New)**: Indexes are now automatically persisted in `_indexes` system table and restored on load.\n- **Query Cache (New)**: LRU Cache for parsed queries to reduce CPU overhead.\n- **Zero Bureaucracy**: Built with **standard PHP**. No massive vendor dependencies.\n- **Network Support**: Client-Server architecture using PHP Streams.\n\n## Philosophy\n\n### Filosofi (ID)\nSawitDB dibangun dengan semangat \"Kemandirian Data\". Kami percaya database yang handal tidak butuh **Infrastruktur Langit** yang harganya triliunan tapi sering *down*. Berbeda dengan proyek negara yang mahal di *budget* tapi murah di kualitas, SawitDB menggunakan arsitektur **Single File** (`.sawit`) yang hemat biaya. Backup cukup *copy-paste*, tidak perlu sewa vendor konsultan asing. Fitur **`fsync`** kami menjamin data tertulis di *disk*, karena bagi kami, integritas data adalah harga mati.\n\n### Philosophy (EN)\nSawitDB is built with the spirit of \"Data Sovereignty\". We believe a reliable database doesn't need **\"Sky Infrastructure\"** that costs trillions yet goes *down* often. Unlike state projects that are expensive in budget but cheap in quality, SawitDB uses a cost-effective **Single File** (`.sawit`) architecture. Backup is just *copy-paste*.\n\n## Installation\n\nInstall via Composer:\n\n```bash\ncomposer require wowoengine/sawitdb-php\n```\n\n## Framework Support\n\n### Vanilla PHP \u0026 CodeIgniter 4\nSawitDB acts as a standard PSR-4 library. You can use the `WowoEngine` directly or connect via the Client.\n\n```php\nuse SawitDB\\Engine\\WowoEngine;\n$db = new WowoEngine(__DIR__ . '/plantation.sawit');\n```\n\n### Laravel Integration\n\nSawitDB includes a ServiceProvider and Facade for seamless Laravel integration.\n\n1.  **Install via Composer**: `composer require wowoengine/sawitdb-php`\n2.  **Configuration**: Publish the config or add to `config/database.php`.\n\n```php\n// config/database.php\n'connections' =\u003e [\n    'sawit' =\u003e [\n        'database' =\u003e env('SAWIT_DB_DATABASE', database_path('plantation.sawit')),\n    ],\n],\n```\n\n3.  **Usage**:\n```php\nuse SawitDB;\n\n// In Controller\npublic function index() {\n    SawitDB::query(\"LAHAN users\");\n    SawitDB::query(\"TANAM KE users (name) BIBIT ('Budi')\");\n    return SawitDB::query(\"PANEN * DARI users\");\n}\n```\n\n## Quick Start (Network Edition)\n\n### 1. Start the Server\n```bash\nphp bin/sawit-server.php\n```\nThe server will start on `0.0.0.0:7878` by default.\n\n### 2. Connect with Client (CLI)\n```bash\nphp cli/remote.php sawitdb://localhost:7878/my_plantation\n```\n\n---\n\n## Usage (Embedded)\n\nYou can use the `WowoEngine` directly in your PHP applications.\n\n```php\nuse SawitDB\\Engine\\WowoEngine;\n\n$db = new WowoEngine(__DIR__ . '/plantation.sawit');\n\n// Generic SQL\n$db-\u003equery(\"CREATE TABLE users\");\n$db-\u003equery(\"INSERT INTO users (id, name) VALUES (1, 'Budi')\");\n\n// AQL\n$db-\u003equery(\"LAHAN trees\");\n$db-\u003equery(\"TANAM KE trees (id, type) BIBIT (1, 'Dura')\");\n\n// Join\n$rows = $db-\u003equery(\"SELECT * FROM trees JOIN users ON trees.id = users.id\");\nprint_r($rows);\n```\n\n## Architecture Details\n\n- **Modular Codebase**: Engine logic separated into `src/` components.\n- **Page 0 (Master Page)**: Contains header and Table Directory.\n- **Data \u0026 Indexes**: Stored in 4KB atomic pages.\n- **WowoEngine**: Core engine orchestrating Pager, Index, and Query Parser.\n\n## Full Feature Comparison\n\n| Feature | Tani Edition (AQL) | Generic SQL (Standard) | Notes |\n|---------|-------------------|------------------------|-------|\n| **Create DB** | `BUKA WILAYAH [db]` | `CREATE DATABASE [db]` | Creates `.sawit` in data/ |\n| **Use DB** | `MASUK WILAYAH [db]` | `USE [db]` | Switch context |\n| **Show DBs** | `LIHAT WILAYAH` | `SHOW DATABASES` | Lists available DBs |\n| **Drop DB** | `BAKAR WILAYAH [db]` | `DROP DATABASE [db]` | **Irreversible!** |\n| **Create Table** | `LAHAN [table]` | `CREATE TABLE [table]` | Schema-less creation |\n| **Show Tables** | `LIHAT LAHAN` | `SHOW TABLES` | Lists tables in DB |\n| **Drop Table** | `BAKAR LAHAN [table]` | `DROP TABLE [table]` | Deletes table \u0026 data |\n| **Insert** | `TANAM KE [table] ... BIBIT (...)` | `INSERT INTO [table] (...) VALUES (...)` | Auto-ID if omitted |\n| **Select** | `PANEN ... DARI [table] DIMANA ...` | `SELECT ... FROM [table] WHERE ...` | Supports Projection |\n| **Join** | `... GABUNG [tbl] PADA ...` | `... JOIN [tbl] ON ...` | Hash/Nested Loop |\n| **Update** | `PUPUK [table] DENGAN ... DIMANA ...` | `UPDATE [table] SET ... WHERE ...` | Atomic update |\n| **Delete** | `GUSUR DARI [table] DIMANA ...` | `DELETE FROM [table] WHERE ...` | Row-level deletion |\n| **Index** | `INDEKS [table] PADA [field]` | `CREATE INDEX ON [table] (field)` | B-Tree Indexing |\n| **Count** | `HITUNG COUNT(*) DARI [table]` | `SELECT COUNT(*) FROM [table]` (via HITUNG) | Aggregation |\n\n### Supported Operators Table\n\n| Operator | Syntax Example | Description |\n|----------|----------------|-------------|\n| **Comparison** | `=`, `!=`, `\u003e`, `\u003c`, `\u003e=`, `\u003c=` | Standard value comparison |\n| **Logical** | `AND`, `OR` | Combine multiple conditions (AND \u003e OR) |\n| **In List** | `IN ('coffee', 'tea')` | Matches any value in the list |\n| **Not In** | `NOT IN ('water')` | Matches values NOT in list |\n| **Pattern** | `LIKE 'Jwa%'` | Standard SQL wildcard matching |\n| **Range** | `BETWEEN 1000 AND 5000` | Inclusive range check |\n| **Null** | `IS NULL` | Check if field is empty/null |\n| **Not Null** | `IS NOT NULL` | Check if field has value |\n| **Limit** | `LIMIT 10` | Restrict number of rows |\n| **Offset** | `OFFSET 5` | Skip first N rows (Pagination) |\n| **Order** | `ORDER BY price DESC` | Sort by field (ASC/DESC) |\n\n## License\n\nMIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwowoengine%2Fsawitdb-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwowoengine%2Fsawitdb-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwowoengine%2Fsawitdb-php/lists"}