sensorario/php-store

关于此软件包最新版本(v0.3.4)的许可信息不可用。

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

README

仅供娱乐的php "数据库"。

折叠

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

示例

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