定制 mongator/behaviors 二次开发

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

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

mongator/behaviors

Composer 安装命令:

composer require mongator/behaviors

包简介

Bahaviors for Mongator, the Simple, powerful and ultrafast Object Document Mapper (ODM) for PHP and MongoDB

README 文档

README

These are the official behaviors of Mongator.

  • Timestampable: Saves the creation and/or update date in the documents.
  • Ipable: Saves the IP from where documents are created and/or saved.
  • Sluggable: Saves the slug of a field in the documents.
  • Archivable: Saves a document copy from one collection to another.
  • Tokenizable: Generates a token on creation.
  • Hasable: Generates a hash for given fields/rels/embs from the given document, on update and/or creation.
  • AutoIncrementable: Auto incrementable field like AUTO_INCREMENT in MySQL
  • Identifiable: Automatically saves an identifier in the document.
  • Stringifiable: Add to the document the magic method __toString, so any document can be converted to string.
  • EmbeddedUniquable: Ensure unique embeddeds document in a embeddedsMany relation.

Requirements

  • PHP 5.3.x;
  • mongator/mongator

Installation

The recommended way of installing Mongator Behaviors is through composer. You can see package information on Packagist.

{
    "require": {
        "mongator/behaviors": "1.4.*"
    }
}

Examples

On your document definition just add a new array named behaviors, just like this:

'Model\MyCollecion' => array(
    'fields' => array(
        'title' => 'string',
    ),
    'behaviors' => array(
        array('class' => 'Mongator\Behavior\Tokenizable'),
        array('class' => 'Mongator\Behavior\Archivable'),
    ),
),

Tests

Tests are in the tests folder. To run them, you need PHPUnit. Example:

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-05-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固