Skip to content

prowebcraft/php-json-db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-json-db

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');