承接 mongator/pimple 相关项目开发

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

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

mongator/pimple

Composer 安装命令:

composer require mongator/pimple

包简介

Provider to use Mongator with Pimple/Silex framework

README 文档

README

Provider for using Mongator with Pimple/Silex framework

Requirements

  • PHP 5.3.x
  • Unix system
  • fabpot/pimple
  • mongator/mongator

Installation

The recommended way to install Mongator/Silex is through composer. You can see the package information on Packagist.

{
    "require": {
        "mongator/pimple": "2.*"
    }
}

Parameters

  • mongator.connection.dsn (default 'mongodb://localhost:27017'): database connection string
  • mongator.connection.database: the database name
  • mongator.connection.name (default 'default'): the name of the connection
  • mongator.metadata.class: The metadata factory class name
  • mongator.logger (default null): instance of a logger class
  • mongator.cache.fields (default ArrayCache): instance of a mongator cache driver used in fields cache
  • mongator.cache.data (default ArrayCache): instance of a mongator cache driver used in data cache
  • mongator.extensions (default Array()): array of extension instances
  • mongator.models.output: output path of the classes
  • mongator.classes.config (default Array()): The config classes contain the information of the classes
  • mongator.classes.yaml.path: A valid dir with YAML definitions of the config classes

Registrating

$app->register(new Mongator\Pimple\MondatorServiceProvider());
$app->register(new Mongator\Pimple\MongatorServiceProvider(), array(
    'mongator.metadata.class' => 'Model\Mapping\Metadata',
    'mongator.models.output' => 'src/',
    'mongator.connection.database' => 'your_db'
));

Usage

use Symfony\Component\HttpFoundation\Response;

$app->post('/article', function ($id) use ($app) {
    $articleRepository = $app['mongator']->getRepository('Model\Article');
    $article = $articleRepository->findOneById($id);

    return new Response('', 201);
});

** Remember, before using the models you must generate them. (You can use the command provided with this package.) **

Commands

With this package you can find three useful commands:

  • mongator:generate: Processes config classes and generates the files of the classes.
  • mongator:indexes: Ensures the indexes of all repositories
  • mongator:fix: Fixes all the missing references.

You need the suggested package cilex/console-service-providerto use console commands on you Silex setup.

Tests

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

$ phpunit --configuration phpunit.xml.dist

License

MIT, see LICENSE

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固