photon/storage-mongodb-object 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

photon/storage-mongodb-object

Composer 安装命令:

composer require photon/storage-mongodb-object

包简介

Micro ORM for MongoDB

README 文档

README

Build Status

Micro ORM for MongoDB

PHP Versions

  • 5.6, 7.0 and 7.1 are supported and tested under travis
  • Use ext-mongodb and mongodb/mongodb. Do not works anymore with legacy ext-mongo

Quick start

  1. Add the module in your project

You need to have composer available in your system

composer require "photon/storage-mongodb-object:dev-master"

or for a specific version

composer require "photon/storage-mongodb-object:^3.0"
  1. Define a database

Define a MongoDB connection in your project configuration

'databases' => array(
    'default' => array(
        'engine' => '\photon\db\MongoDB',
        'server' => 'mongodb://localhost:27017/',
        'database' => 'orm',
        'options' => array(
            'connect' => true,
        ),
    ),
),
  1. Create custom object

For exemple a class to store user informations

class User extends \photon\storage\mongodb\Object
{
    const collectionName = 'users';

    public function initObject()
    {
        $this->ctm = new DateTime;
        $this->activated = false;
    }
}
  1. Use it

Use you object in your PHP code

$user = new User;
$user->name = 'Foo';
$user->save();
  1. Enjoy !

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-2.1-or-later
  • 更新时间: 2015-12-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固