定制 commentar/json-storage 二次开发

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

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

commentar/json-storage

Composer 安装命令:

composer require commentar/json-storage

包简介

This storage mechanism requires no database, but rather stores the data encoded in the JSON format on the filesystem.

README 文档

README

Build Status Scrutinizer Quality Score Code Coverage Latest Stable Version Total Downloads

Storage mechanism for the Commentar project. This storage mechanism requires no database, but rather stores the data encoded in the JSON format on the filesystem.

This should only be used for development purposes to have a portable way of introducing some persistent storage. It should never be used in production.

Installation

Add the storage mechanism to the project's composer.json file:

"require": {
    "commentar/json-storage": "0.0.*",
}

Add the default admin user in the /data/users.json file:

{
    "autoincrement": 1,
    "users": {
        "1": {
            "id": 1,
            "username": "PeeHaa",
            "password": "$2y$14$Usk4vuNbzowQihbscOZjcu6RRzPBK3zIn79F8wn.bjczbElrqzbJu",
            "email": "your@mail.com",
            "isHellbanned": false,
            "isAdmin": true
        }
    }
}

The password should be hashed using PHP's native password hashing function (password_hash()). The easiest way to generate the password hash is by either using this service or by manually running the password hashing function: echo password_hash('Your super secret password', PASSWORD_DEFAULT, ['cost' => 14]);.

To start using the storage you will have to start using the provided datamapper factory by this library. An example of retrieving the comment tree of a thread is:

$domainObjectFactory = new \Commentar\DomainObject\Factory();
$datamapperFactory   = new \Commentar\Storage\Json\Factory(__DIR__ . '/vendor/commentar/json-storage/data');
$commentService      = new \Commentar\Service\Comment($domainObjectFactory, $datamapperFactory);

$commentTree = $commentService->getTree(1);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-09-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固