PHP code example of fire015 / flintstone

1. Go to this page and download the library: Download fire015/flintstone 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/ */

    

fire015 / flintstone example snippets



Flintstone\Flintstone;

$users = new Flintstone('users', ['dir' => '/path/to/database/dir/']);



// Load a database
$users = new Flintstone('users', ['dir' => '/path/to/database/dir/']);

// Set a key
$users->set('bob', ['email' => '[email protected]', 'password' => '123456']);

// Get a key
$user = $users->get('bob');
echo 'Bob, your email is ' . $user['email'];

// Retrieve all key names
$keys = $users->getKeys(); // returns array('bob')

// Retrieve all data
$data = $users->getAll(); // returns array('bob' => array('email' => '[email protected]', 'password' => '123456'));

// Delete a key
$users->delete('bob');

// Flush the database
$users->flush();


Flintstone\Flintstone;
use Flintstone\Formatter\JsonFormatter;

$users = new Flintstone('users', [
    'dir' => __DIR__,
    'formatter' => new JsonFormatter()
]);