rumd3x/php-persistence
Composer 安装命令:
composer require rumd3x/php-persistence
包简介
Store and retrieve data without a database.
README 文档
README
Store persistent data and retrieve it without a database.
Installation
To install via composer just run
composer require rumd3x/php-persistence
Usage
Getting started
Create an instance of the Persistence Engine passing a string with the driver name. Every driver is a totally different database. If data is getting too hard to manage you should probably be using more drivers.
use Rumd3x\Persistence\Engine; $driver = 'test-db'; $db = new Engine($driver);
Storing data
You can store an instance of any object, arrays of mixed data, strings, etc.
When you retrieve your data, you'll get back exactly what you've stored.
When your data is stored, it's being put at the bottom of a stack.
$array = ['hello' => 'world', 1234, 1.666]; $db->store($array);
Retrieving data
The engine uses FIFO.
So when you retrieve your data, you'll be retrieving from the top of the stack.
If the driver has nothing stored in it, it will return null
Also, when you retrieve your data, it will be erased from the stack, so if you are using it again, make sure to store it back.
$data = $db->retrieve();
统计信息
- 总下载量: 944
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-02