定制 ronolo/json-database 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 ronolo/json-database 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-09