wallrio/deskdb
Composer 安装命令:
composer require wallrio/deskdb
包简介
A small embedded database, based on JSON format.
README 文档
README
A small embedded database, based on JSON format.
Installation
It's recommended that you use Composer to install Directly.
$ composer require wallrio/deskdb "*"
Instantiate a collection class
use deskdb\Collection as Collection; $deskdb = new Collection(COLLECTION_NAME,DRIVER);
- Example
use deskdb\drivers\JSON as JSON; use deskdb\Collection as Collection; $collection = new Collection('users',new JSON(__DIR__.'/mybase/'));
JSON, is the class responsible for effectively carrying out operations.
JSON, if the contractor's value is omitted, then the system's temporary directory will be used.
Create a document
use deskdb\Document as Document; $user = new Document(); $user->name = "Fulano da Silva"; $user->username = "fulano"; $user->password = md5("fulano"); $collection->post($user);
Search all documents in the collection
$result = $collection->get();
Search for a document
$result = $collection->get(KEY,VALUE,OPERATOR);
- KEY: can be any document key
- VALUE: can be any document value, partial or whole
- OPERATOR: reference value to perform the search
- ==: search for a similar value
- !=: search for different value
- ===: search by identical value
- !==: look for exactly different value
- like: look for a similar value (type soundex)
- !like: search for unlike value (type soundex)
- contain: search by value part
- !contain: search for part of non-existent value
Search for the first document occurrence
$result = $collection->getFirst(KEY,VALUE,OPERATOR);
Delete document
$result = $collection->get(); $collection->delete($result);
the value ** delete ** accepts an array of results
Update document
$result = $collection->getFirst(); $result->name="ANOTHER NAME"; $result->age="34"; $collection->put($result);
the ** put ** value accepts an array of results
Recomendations
It is explicitly recommended to use the code below to block the viewing of your JSON directories and documents.
Below example of script for blocking
APACHE
Create an .htaccess file in your application's main directory
# Block directory list view Options -Indexes # Block the visualization of document JSON <Files "*_deskdb.json"> Order Allow,Deny Deny from all </Files>
NGINX
Insert the excerpt below into your server's nginx.conf file.
location ~ \.*_deskdb.json { deny all; }
License
The DeskDB is licensed under the MIT license. See License File for more information.
wallrio/deskdb 适用场景与选型建议
wallrio/deskdb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 52 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 06 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 wallrio/deskdb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wallrio/deskdb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 52
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-16