juliangut/slim-doctrine-middleware 问题修复 & 功能扩展

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

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

juliangut/slim-doctrine-middleware

最新稳定版本:0.3.2

Composer 安装命令:

composer require juliangut/slim-doctrine-middleware

包简介

Slim Framework Doctrine middleware

README 文档

README

Latest Version License

Build status Code Quality Code Coverage Total Downloads

Juliangut Slim Framework Doctrine handler middleware

Doctrine handler middleware for Slim Framework.

Slim3 version

Doctrine integration service for Slim3 can be found in its own repository juliangut/slim-doctrine

Installation

Best way to install is using Composer:

php composer.phar require juliangut/slim-doctrine-middleware

Then require_once the autoload file:

require_once './vendor/autoload.php';

Usage

Just add as any other middleware.

use Slim\Slim;
use Jgut\Slim\Middleware\DoctrineMiddleware;

$app = new Slim();

...

$app->add(new DoctrineMiddleware());

Configuration

There are two ways to configure Doctrine Middleware

First by using doctrine key in Slim application configuration

// Minimun configuration
$config = [
    'doctrine' => [
        'connection' => [
            'driver' => 'pdo_sqlite',
            'memory' => true,
        ],
        'annotation_paths' => ['path_to_entities_files'],
    ],
];

$app = new Slim($config);
$app->add(new DoctrineMiddleware());

Second way is assigning options directly to Doctrine Middleware

$app = new Slim();

$doctrineMiddleware = new DoctrineMiddleware();
$doctrineMiddleware->setOption(
    'connection',
    ['driver' => 'pdo_sqlite', 'memory' => true]
);
$doctrineMiddleware->setOption('annotation_paths', ['path_to_entities_files']);
$app->add($doctrineMiddleware);

Available configurations

  • connection array of PDO configurations
  • cache_driver array with Doctrine cache configurations
    • type string representing cache type, apc, xcache, memcache, redis or array
    • host string representing caching daemon host, needed for memcache and redis, defaults to '127.0.0.1'
    • port string representing caching daemon port, optionally available for memcache (defaults to 11211) and redis (defaults to 6379)
  • proxy_path path were Doctrine creates its proxy classes, defaults to /tmp
  • annotation_files array of Doctrine annotations files
  • annotation_namespaces array of Doctrine annotations namespaces
  • annotation_autoloaders array of Doctrine annotations autoloader callables
  • annotation_paths array of paths where to find annotated entity files
  • xml_paths array of paths where to find XML entity mapping files
  • yaml_paths array of paths where to find YAML entity mapping files
  • auto_generate_proxies bool indicating whether Doctrine should auto-generate missing proxies (default: true)

Note:

annotation_paths, xml_paths or yaml_paths is needed by Doctrine to include a Metadata Driver

Contributing

Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before

See file CONTRIBUTING.md

Contributors

License

Release under BSD-3-Clause License.

See file LICENSE included with the source code for a copy of the license terms

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2015-04-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固