Juliangut Slim Framework Doctrine handler middleware

Overview

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

You might also like...
Slim Framework - Prerequisite Checker
Slim Framework - Prerequisite Checker

Slim Framework - Server Configuration Checker Upload the file check.php to your webserver Browse to the file: https://example.com/check.php Check the

REST APIs using Slim framework. Implemented all CRUD operations on the MySql database
REST APIs using Slim framework. Implemented all CRUD operations on the MySql database

PHP REST API using slim framework and CRUD operations 🖐 Hi there, this is a simple REST API built using the Slim framework. And this is for the folks

A Slim PHP MVC framework built just for fun!

Aura Framework A Slim PHP MVC framework built just for fun! en: Note: This repository only contains the core code of the Aura framework. If you want t

Slim Framework skeleton application with MVC Schema

Slim Framework skeleton application with MVC Schema

A curated list of awesome tutorials and other resources for the Slim micro framework

Awesome Slim A curated list of awesome tutorials and other resources for the Slim micro framework Table of Contents Essentials Tutorials Packages and

Slim Framework 3 Skeleton Application + PagSeguro Lib

Slim Framework 3 Skeleton Application + PagSeguro Lib Aplicação simples para geração do Token para pagamentos no PagSeguro (método transparente) e env

My personal blog developed on the Slim Framework

nesbot.com I am making the source code of my personal site available publicly in case it helps anybody. It's developed using the Slim Framework. I am

Plates Template Integration for Slim micro framework 3

Plates Template Integration for Slim micro framework 3 Render your Slim 3 application views using Plates template engine. Install Via Composer $ compo

Strict PSR-7 implementation used by the Slim Framework

Strict PSR-7 implementation used by the Slim Framework, but you may use it separately with any framework compatible with the PSR-7 standard.

Comments
  • hhvm build fails because of redis

    hhvm build fails because of redis

    redis extension seems to be loaded in hhvm on Travis, so testRedisCacheConfiguration test configures it with the default values but it ends throwing an error:

    1) MiddlewareTests\DoctrineCacheFactoryTest::testRedisCacheConfiguration
    unable to connect to 127.0.0.1 [111]: Connection refused
    
    help wanted 
    opened by juliangut 1
Owner
Julián Gutiérrez
Julián Gutiérrez
This Slim Framework middleware will compile LESS CSS files on-the-fly using the Assetic library

This Slim Framework middleware will compile LESS CSS files on-the-fly using the Assetic library. It supports minification and caching, also via Asseti

Gerard Sychay 22 Mar 31, 2020
Access control middleware for Slim framework

Slim Access Access control middleware for Slim framework. Supported formats IPv4 and IPv6 addresses CIDR notation all keyword Installation composer re

Alexandre Bouvier 7 Oct 22, 2019
Redis cache middleware for Slim framework

RedisCache Redis cache middleware for Slim framework. Installation composer require abouvier/slim-redis-cache Usage Cache every successful HTTP respo

Alexandre Bouvier 16 Sep 20, 2021
Slim Framework HTTP cache middleware and service provider

Slim Framework HTTP Cache This repository contains a Slim Framework HTTP cache middleware and service provider. Install Via Composer $ composer requir

Slim Framework 107 Dec 15, 2022
CORS Middleware for PHP Slim Framework

CorsSlim Cross-origin resource sharing (CORS) Middleware for PHP Slim Framework. Usage Composer Autoloader Install with Composer Update your composer.

Palani Kumanan 92 Nov 30, 2021
PHP slim framework middleware to minify HTML output

slim-minify Slim middleware to minify HTML output generated by the slim PHP framework. It removes whitespaces, empty lines, tabs beetween html-tags an

Christian Klisch 35 Oct 31, 2021
Slim Framework CSRF protection middleware

Slim Framework CSRF Protection This repository contains a Slim Framework CSRF protection PSR-15 middleware. CSRF protection applies to all unsafe HTTP

Slim Framework 302 Dec 11, 2022
🎲 This project provides an integration for the Doctrine ORM and the Hyperf framework

Hyperf ?? Doctrine This project provides an integration for the Doctrine ORM and the Hyperf framework. Install composer require leocavalcante/hyperf-d

Leo Cavalcante 49 Dec 3, 2022
Software for an e-book library, in Bulgarian only. Based on Symfony3 and Doctrine 2.

chitanka.info core Това е уеб софтуер, който задвижва „Моята библиотека“. Изграден е с помощта на Symfony3, Doctrine 2 и много други прекрасни свободн

null 46 Oct 1, 2022
Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.

Slim Framework Slim is a PHP micro-framework that helps you quickly write simple yet powerful web applications and APIs. Installation It's recommended

Slim Framework 11.5k Jan 4, 2023