From 65d729d6a96effbeb3af59c78f32a09f163467a6 Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Tue, 28 Jan 2025 14:07:30 +0700 Subject: [PATCH] created readme for 1.0.0 --- README.md | 71 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b235e2e..6178e57 100755 --- a/README.md +++ b/README.md @@ -1,36 +1,69 @@ -# Ebaboba database -A lightweight database by pure PHP
+# Ebaboba +Lightweight binary database by pure PHP
-At the moment the project is a modified RFC 4180 - -`2024.12.14` **IN DEVELOPMENT! DO NOT USE IN PROJECTS!** - -## Requirements -- PHP 8.4 +## Dependencies +1. ![PHP 8.4](https://www.php.net/releases/8.4/en.php) +2. ![Composer](https://getcomposer.org/) (php package manager) ## Installation -1. `composer require mirzaev/ebaboba` -2. Create a class that inherits `mirzaev/ebaboba/database` and redefine the `database::FILE` constant -3. Enjoy! +`composer require mirzaev/ebaboba` ## Example ```php encoding(encoding::utf8) + ->columns( + new column('name', type::string, ['length' => 32]), + new column('second_name', type::string, ['length' => 64]), + new column('age', type::integer), + new column('height', type::float) + ) + ->connect(__DIR__ . DIRECTORY_SEPARATOR . 'database.ba'); // Initializing the record -$record = new record(['Arsen', '23', time()); +$record = $database->record( + 'Arsen', + 'Mirzaev', + 23, + (float) 165 +); -// Writing to the database -$database->write($record); +if ($database->write($record)) { + // Writed the record into the database + + // Updating the record in the database + $updated = $database->read( + filter: fn($record) => $record->name === 'Arsen', + update: fn(&$record) => $record->age = 24, + amount: 1 + ); + + // Reading the record from the database + $readed = $database->read( + filter: fn($record) => $record->name === 'Arsen' && $record->age === 24, + amount: 1 + ); + + // Deleting the record from the database + $deleted = $database->read( + filter: fn($record) => $record->age < 25, + delete: true, + amount: 1000 + ); +} ?> ``` ## Used by -- My site-article about how i was kidnapped by PMC Wagner operatives [mirzaev/repression](https://git.mirzaev.sexy/mirzaev/repression) -- My decentralized P2P blockchain chats project [mirzaev/notchat](https://git.mirzaev.sexy/mirzaev/notchat) +- My site-article about how i was kidnapped by PMC Wagner operatives [mirzaev/repression](https://git.svoboda.works/mirzaev/repression) +- My decentralized P2P blockchain chats project [mirzaev/notchat](https://git.svoboda.works/mirzaev/notchat) +- Svoboda Telegram chat-robot [svoboda/negotiator](https://git.svoboda.works/svoboda/negotiator)