irfantoor/datastore
Composer 安装命令:
composer require irfantoor/datastore
包简介
Data Store of key, value pairs
README 文档
README
Storage of an key, value pair to a filesystem
Quick Start
Incstallation or inclusion in your project:
$ composer require irfantoor/datastore
Creating the Datastore:
$ds = new IrfanTOOR\Datastore('/yourpath/to/datatore/');
has($id)
Verify if the store has an entity with the requested id. returns true or false
$ds = new IrfanTOOR\Datastore('/yourpath/to/datatore/'); if ($ds->has('hello')) { echo $ds->get('hello'); }
set($id, $value, $meta = [])
Sets the value of an id:
$ds->set('hello', 'Hello'); $ds->set('hello-world', 'Hello World!'); # ...
Any other information regarding can be stored using the 3rd argument $meta.
$meta = [ 'meta' => [ 'keywords' => 'hello, world', 'author' => 'Jhon Doe', # ... ]; ]; $ds->setComponents('hello', 'Hello World!', $meta);
info($id)
You can use the function info to retrive the information of an entity:
$info = $ds->info('hello-world'); print_r($info); # Note: the information does not contain the value, which can be retrieved using # the get function
get($id)
Returns the value associated to an id:
$contents = $ds->get('hello', 'Hello'); echo $contents; echo $ds->get('hello-world');
remove($id)
Removes an entity assosiated to the provided id:
$ds->remove('hello');
addFile($key, $file, $meta = [])
You can add a file to the datastore, using this function.
$file = 'absolute\path\to\your\reference_file.txt'; $ds->addFile('reference', $file); # or you can add some meta information $ds->addFile('reference', $file, ['keywords' => 'reference', 'sites', 'index', '...']);
统计信息
- 总下载量: 40
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-22