Basic Object Storage System for small data.
Do not use 'Flatfile' for storing big data!
The Library is PSR-1, PSR-4, PSR-12 compliant.
>= PHP 7.2
composer require typomedia/flatfile
use Typomedia\Flatfile\Flatfile;
$data = [
'Moretti' => [
'name' => 'Style Ale',
'style' => 'European Amber Lager',
'alcohol' => '9.1%'
]
];
$flatfile = new Flatfile('test.json');
$key = md5(serialize($data));
$flatfile->set((object)$data, $key);
$flatfile->get($key);
$flatfile->first();
$flatfile->last();
$flatfile->keys();
$flatfile->find('name', 'Style Ale');
$flatfile->delete($key);