sensorario/php-store

There is no license information available for the latest version (v0.3.4) of this package.

v0.3.4 2019-07-01 23:51 UTC

README

Just for fun php "database".

Folding

Memory
├── Config
│   └── Config
├── Model
│   └── Collection
├── Persistor
│   ├── FileSystemPersistor
│   └── PersistorPort
├── Services
│   ├── Helper
│   │   └── Matcher
│   ├── Memory
│   ├── NewLocalStorage
│   └── Persist
└── Storage

Example

use Memory\Config\Config;
use Memory\Services\Memory;
use Memory\Services\Persist;
use Memory\Persistor\FileSystemPersistor;
use Memory\Storage;

class Store
{
    private $storage;

    public function __construct()
    {
        $config = new Config([
            'path' => __DIR__ . '/../../../../var/data/store',
        ]);

        $memory = new Memory();
        $memory->init($config);
        $memory->loadFromFileSystem();

        $this->storage = new Storage(
            $memory,
            new Persist(
                new FileSystemPersistor(),
                $config
            ),
            $config
        );
    }

    public function getStorage()
    {
        return $this->storage;
    }
}