typomedia/flatfile

Flatfile Storage

1.0.0 2021-07-12 08:55 UTC

This package is auto-updated.

Last update: 2024-11-12 16:13:08 UTC


README

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.

Requirements

  • >= PHP 7.2

Install

composer require typomedia/flatfile

Usage

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