lazier/storage
Composer 安装命令:
composer require lazier/storage
包简介
Lazier key-value store
README 文档
README
Lazier Storage provides a simple key-value store. Often you want to bootstrap an application and use a file-based key-value store. Maybe you want to use to another adapter later. For this case there are different adapters for this component.
Lazier Storage is inspired by the LocalStorage and SessionStorage known from web browsers.
In addition, the JSON adapter is compatible with the one from the package webmozart/key-value-store,
which is no longer compatible with PHP 8.
Installation
Using Composer:
composer require lazier/storage
Usage
Example:
<?php use Lazier\Storage\Adapter\JsonFileStorage; use Lazier\Storage\SimpleStorage; $store = SimpleStorage::createWith(JsonFileStorage::create(__DIR__ . '/test.json')); $store->clear(); $store->setItem('foo', 'bar'); $store->getItem('foo'); // returns "bar" $store->removeItem('foo'); count($store); // 0
You can also use adapters directly:
<?php use Lazier\Storage\Adapter\EnvStorage; $store = EnvStorage::create(); if ($store->getItem('APP_ENV') === 'dev') { echo 'Running in dev environment...' . PHP_EOL; }
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-31