{"id":24769406,"url":"https://github.com/codewithsushil/json-db","last_synced_at":"2025-10-11T19:30:52.193Z","repository":{"id":273289967,"uuid":"919223299","full_name":"CodeWithSushil/json-db","owner":"CodeWithSushil","description":"JSON DB for APIs Testing and minimalist project","archived":false,"fork":false,"pushed_at":"2025-01-27T10:31:04.000Z","size":52,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-27T11:42:27.681Z","etag":null,"topics":["json-api","json-database","json-db","json-server"],"latest_commit_sha":null,"homepage":"","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/CodeWithSushil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"ashishkumbhar01","patreon":"code_with_sushil","open_collective":"codewithsushil","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"codewithsushil","thanks_dev":null,"custom":null}},"created_at":"2025-01-20T01:45:57.000Z","updated_at":"2025-01-27T10:31:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"906ece18-51d0-4c5e-ac8e-82d5f50ca6cf","html_url":"https://github.com/CodeWithSushil/json-db","commit_stats":null,"previous_names":["codewithsushil/json-db"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithSushil%2Fjson-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithSushil%2Fjson-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithSushil%2Fjson-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeWithSushil%2Fjson-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeWithSushil","download_url":"https://codeload.github.com/CodeWithSushil/json-db/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236122009,"owners_count":19098257,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["json-api","json-database","json-db","json-server"],"created_at":"2025-01-29T02:53:38.437Z","updated_at":"2025-10-11T19:30:52.188Z","avatar_url":"https://github.com/CodeWithSushil.png","language":"PHP","readme":"![JsonDB](/art/jsondb.png)\n\n[![Tests](https://github.com/CodeWithSushil/json-db/actions/workflows/tests.yml/badge.svg)](https://github.com/CodeWithSushil/json-db/actions/workflows/tests.yml)\n![Packagist Version](https://img.shields.io/packagist/v/jsondbphp/jsondb?style=flat\u0026logo=composer\u0026logoColor=%23fff)\n![Packagist Dependency Version](https://img.shields.io/packagist/dependency-v/jsondbphp/jsondb/php?style=flat\u0026logo=php\u0026logoColor=blue\u0026label=PHP\u0026color=blue)\n![Packagist License](https://img.shields.io/packagist/l/jsondbphp/Jsondb?style=flat\u0026label=License\u0026color=blue)\n![Packagist Downloads](https://img.shields.io/packagist/dt/jsondbphp/Jsondb?style=flat\u0026label=Downloads\u0026color=blue)\n![Packagist Stars](https://img.shields.io/packagist/stars/jsondbphp/jsondb?style=flat\u0026logo=packagist\u0026logoColor=%23ffffff\u0026label=%F0%9F%8C%9F%20Stars)\n\n\n**JsonDB** is a lightweight, document-oriented NoSQL-style database written in PHP. It provides a simple, file-based alternative to traditional databases by storing and managing data as structured JSON files. JsonDB is perfect for lightweight apps, prototyping, local storage, and embedded tools where a full-fledged database system is unnecessary.\n\n---\n\n## 🚀 Features\n\n- ⚡ **Zero-Config:** No database server or setup needed—just PHP and your filesystem.\n- 🧩 **Document-Based:** Each collection is a JSON file; each record is a structured JSON document.\n- 🧪 **CRUD Operations:** Easy-to-use API for create, read, update, and delete operations.\n- 🕵️‍♂️ **Search \u0026 Filter:** Built-in query capabilities using associative arrays and conditions.\n- [x] Coming soon\n- 🔐 **JWT \u0026 Session Authentication:** Secure API with optional login/auth guard.\n- 🌐 **REST API Wrapper:** JSON RESTful interface for HTTP clients.\n- 🗃️ **Transactions \u0026 Atomic Writes:** Prevents data corruption with locking mechanisms.\n- 🔁 **Replication \u0026 Backup Support:** Optional add-ons for syncing and restoring data.\n- 🧰 **CLI Tools:** Perform operations via command line using Symfony Console.\n- 🧠 **In-memory Caching:** Fast reads with optional caching for large JSON datasets.\n- 🧾 **Indexing (Planned):** For quicker lookups and searches on large datasets.\n\n---\n\n## 📦 Why Use JsonDB?\n\n- ✅ **Simple:** No external dependencies, DB servers, or complex setup.\n- ✅ **Portable:** Just include it in your project—works anywhere PHP runs.\n- ✅ **Human-Readable:** JSON files are easy to read, edit, version-control, and debug.\n- ✅ **Great for Prototyping:** Ideal for testing APIs, local apps, and building offline tools.\n- ✅ **Customizable:** Built in modern PHP (PHP 8.4+), uses OOP, Traits, Enums, and Interfaces.\n\n---\n\n## 💡 Use Cases\n\n- 🔧 Rapid API Prototyping\n- 🗃 Offline Data Storage\n- 🧪 Test Mock Databases\n- 🛠 Configuration/Settings Store\n- 🎮 Game Save/State Files\n- 🌐 Lightweight Backend for SPA/JS apps\n- 💻 CLI Data Manipulation Tools\n\n---\n\n## 🧑‍💻 How It Works\n\n#### Install\n\n```bash\ncomposer require jsondbphp/jsondb\n```\n\n#### Example\n\n- First create a folder `data`.\n- Create a `users.json` file inside of data folder.\n\n```php\n\u003c?php\n\nrequire(\"vendor/autoload.php\");\n\nuse Json\\Database\\JsonDB;\n\n// Create DB instance\n$db = new JsonDB(__DIR__ . '/data');\n\n// Insert\n$db-\u003einsert('users', [\n    'name' =\u003e 'Alice',\n    'email' =\u003e 'alice@example.com'\n]);\n\n// findAll\n$result = $db-\u003efindAll('users');\nprint_r($resull);\n\n// find\n$result = $db-\u003efind('users', 'name');\nprint_r($result);\n\n// update\n$db-\u003eupdate('users', 'name', 'Alice');\n\n// delete\n$db-\u003edelete('users', 'name');\n\n```\n\n---\n","funding_links":["https://github.com/sponsors/ashishkumbhar01","https://patreon.com/code_with_sushil","https://opencollective.com/codewithsushil","https://buymeacoffee.com/codewithsushil"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsushil%2Fjson-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodewithsushil%2Fjson-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodewithsushil%2Fjson-db/lists"}