created readme for 1.0.0

This commit is contained in:
Arsen Mirzaev Tatyano-Muradovich 2025-01-28 14:07:30 +07:00
parent f56de9b053
commit 65d729d6a9

View File

@ -1,36 +1,69 @@
# Ebaboba database # Ebaboba
A lightweight database by pure PHP<br> Lightweight binary database by pure PHP<br>
At the moment the project is a modified RFC 4180 ## Dependencies
1. ![PHP 8.4](https://www.php.net/releases/8.4/en.php)
`2024.12.14` **IN DEVELOPMENT! DO NOT USE IN PROJECTS!** 2. ![Composer](https://getcomposer.org/) (php package manager)
## Requirements
- PHP 8.4
## Installation ## Installation
1. `composer require mirzaev/ebaboba` `composer require mirzaev/ebaboba`
2. Create a class that inherits `mirzaev/ebaboba/database` and redefine the `database::FILE` constant
3. Enjoy!
## Example ## Example
```php ```php
<?php <?php
// Ebaboba database use use mirzaev\ebaboba\database,
use mirzaev\ebaboba\{database, record}; mirzaev\ebaboba\column,
mirzaev\ebaboba\record,
mirzaev\ebaboba\enumerations\encoding,
mirzaev\ebaboba\enumerations\type;
// Initializing the database // Initializing the database
$database = new database('name', 'age', 'created'); $database = new database()
->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 // Initializing the record
$record = new record(['Arsen', '23', time()); $record = $database->record(
'Arsen',
'Mirzaev',
23,
(float) 165
);
// Writing to the database if ($database->write($record)) {
$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 ## Used by
- My site-article about how i was kidnapped by PMC Wagner operatives [mirzaev/repression](https://git.mirzaev.sexy/mirzaev/repression) - 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.mirzaev.sexy/mirzaev/notchat) - 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)