View on GitHub

ArkaDB

ArkaDB is a simple CRUD like database implemented in PHP without any third-party dependencies that store data in JSON files.

download .ZIPdownload .TGZ

ArkaDB

A simple CRUD Database made with ❤️ and PHP.

ArkaDB is a simple CRUD like database implemented in PHP without any third-party dependencies that store data in JSON files.

It’s not comparable with databases like SQL but you can compare it with databases like MongoDB.


Motivation

I’m Arkaneel Roy I’m 15 (2023) and I created it as a hobby project but with the help contribution of you all I wanna expand this project.


Features


Installation

git clone https://github.com/Arkaneel/ArkaDB

Then include it as :

include 'ArkaDB/ArkaDB.php';

Initialization

$database = ArkaDB('Name of Your Database','Name of Your Database Folder');
$database = ArkaDB('database','db');

This creates a database named database.json in the folder db


Supported Functions

Function Usage
insert() Inserts Data.
get() Gets Data through `Static Key`.
getAll() Gets all the Data registered in the database.
update() Updates Data registered in the database.
delete() Deletes Data using `Static Key`.

Example Usages.

1.insert( )

$database = new ArkaDB('data', 'data_folder');

$data = [
  'name' => 'John Doe',
  'email' => 'johndoe@example.com',
  'age' => 25
];

$id = $database->insert($data);


echo "Inserted data with ID: " . $id;

2.Get( )

$database = new ArkaDB('data', 'data_folder');


$id = 'static-key';

$data = $database->get($id);


if ($data) {
  echo "Retrieved data:\n";
  print_r($data);
} else {
  echo "Data not found.";
}

3.GetAll( )

$database = new ArkaDB('data', 'data_folder');


$allData = $database->getAll();


echo "All data:\n";
print_r($allData);

4.update( )

$arkaDB = new ArkaDB('data', 'data_folder');


$id = 'static-key'; 
$newData = [
  'name' => 'John Doe',
  'email' => 'johndoe@example.com',
  'age' => 30
];


$result = $arkaDB->update($id, $newData);

if ($result) {
  echo "Data updated successfully.";
} else {
  echo "Failed to update data.";
}

5.delete( )

$database = new ArkaDB('data', 'data_folder');


$id = 'static-key';


$deleted = $database->delete($id);


if ($deleted) {
  echo "Data with ID $id deleted successfully.";
} else {
  echo "Data not found.";
}

If you like this then please share it to twitter: