1. Go to this page and download the library: Download chillu/fakedatabase library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
chillu / fakedatabase example snippets
// Instanciation
$db = new FakeDatabase('/tmp/my_database.json');
// Set a new object with the key 'john' (or override an existing one)
$db->set('User', 'john', new FakeObject(array(
'email' => '[email protected]',
'firstname' => 'John',
'address' => array(
'street' => 'Test Road',
'city' => 'Testington',
'postcode' => 9999
)
)));
// Update (merges with existing data through array_merge())
$db->update('User', 'john', new FakeObject(array('surname' => 'Test')));
// Get all objects for a certain type
$objs = $db->getAll('User');
// Get by key
$obj = $db->get('User', 'john');
// Simple find
$obj = $db->find('User', 'email', '[email protected]');
// Complex find by dot notation
$obj - $db->find('User', 'address.postcode', 9999);
// Reset the whole database
$db->reset('User', 'address.postcode', 9999);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.