承接 wallrio/deskdb 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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);

Another examples

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固