ronolo/json-database
Composer 安装命令:
composer require ronolo/json-database
包简介
A lightweight JSON document database, which sits on top of ronolo/json-store and adds document relations and query caching.
README 文档
README
This is an on-top sitting extension of ronolo/json-store which adds additional database like features to the JSON document store. Please read https://github.com/RoNoLo/json-store/blob/master/README.md to learn what you can do with it.
This extension adds relation ships between JSON documents.
Usage
$config = Database\Config(); $config->addStore('person', (new Store\Config())->setAdapter(new MemoryAdapter())); $config->addStore('interests', (new Store\Config())->setAdapter(new MemoryAdapter())); $database = Database::create($config);
This will tell the database, that it knows 2 JSON stores under the hood and when ever a query against the database will happen the database will look for referenced documents put them in place and return the documents normally.
A Referenced document is one which lives in it own store, but is maybe shared by other store documents. Here an example how it looks under the hood.
$config = Database\Config(); $config->addStore('person', (new Store\Config())->setAdapter(new Local('/foo/bar/persons'))); $config->addStore('interests', (new Store\Config())->setAdapter(new Local('/foo/bar/interests'))); $database = Database::create($config); // Create a few interests $hobby1 = $database->put('interests', ['name' => 'Music', 'stars' => 4], true); $hobby2 = $database->put('interests', ['name' => 'Boxen', 'stars' => 3.4], true); $hobby3 = $database->put('interests', ['name' => 'Movies', 'stars' => 5], true); // Create some persons $person1 = $database->put('person', [ 'name' => 'Ronald', 'interests' => [$hobby1, $hobby2] ]); $person2 = $database->put('person', [ 'name' => 'Ellen', 'interests' => [$hobby2, $hobby3] ]); $person3 = $database->put('person', [ 'name' => 'James', 'interests' => [] ]); $person4 = $database->put('person', [ 'name' => 'Katja', 'interests' => [$hobby3, $hobby1, $hobby2] ]); // Request of Katja which will return a JSON object with her 3 hobbies dereferenced. $katja = $database->read('person', $person4);
Katja as JSON:
{
"name": "Katja",
"interests": [
{
"name": "Movies",
"stars": 5
},
{
"name": "Music",
"stars": 4
},
{
"name": "Boxen",
"stars": 3.5
}
]
}
Goals
- No real database needed like SqlLite, Mysql, MongoDB, CouchDB ...)
- PHP 7.2+
- Document Store aka NoSQL
- JSON as format of storage
- (very) low memory usage even for huge results
- NoSQL like query syntax (CouchDB style)
- Repository and database (document relations) usage options
- Abstract data location via https://flysystem.thephpleague.com/
ronolo/json-database 适用场景与选型建议
ronolo/json-database 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 10 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「nosql」 「json」 「file」 「db」 「document」 「flat」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ronolo/json-database 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ronolo/json-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ronolo/json-database 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The DreamFactory(tm) CouchDB Service.
Kinikit - PHP Application development framework MVC component
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
The CodeIgniter Redis package
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-09