Simple And Flexible database in JSON file
#Installation
composer require prowebcraft/php-json-db
#Usage Create JsonDb instance
$db = new \Prowebcraft\JsonDb([
'name' => 'users.json',
'dir' => getcwd()
]);
Add some data
$db->set('user', [
'firstname' => 'John',
'lastname' => 'Doe'
]);
Add more data to existing array
$db->set('user.age', 18);
Save data to storage
$db->save();
You will get file in current working directory named users.json with sample data:
{
"user": {
"firstname": "John",
"lastname": "Doe",
"age": 18
}
}
Get items
$db->get('user.age');