2017 © Pedro Peláez
 

library silex-doctrine-annotations-provider

Doctrine annotations service provider for Pimple 3.x / Silex 2.x

image

skalpa/silex-doctrine-annotations-provider

Doctrine annotations service provider for Pimple 3.x / Silex 2.x

  • Wednesday, April 12, 2017
  • by skalpa
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status Scrutinizer Code Quality Code Coverage, (*1)

Doctrine Annotations Service Provider for Silex 2.x / Pimple 3.x

Lets you to use the Doctrine annotations reader in your Silex/Pimple application., (*2)

Installation

Install the service provider using composer:, (*3)

composer require skalpa/silex-doctrine-annotations-provider

Registration

$app->register(new \Skalpa\Silex\Doctrine\AnnotationsServiceProvider());

$fooAnnotations = $app['annotations']->getClassAnnotations(new \ReflectionClass('Foobar\FooClass'));

Configuration parameters

Parameter Type Default Description
annotations.use_simple_reader bool false Whether to use the Doctrine AnnotationReader or SimpleAnnotationReader class
annotations.register_autoloader bool true Whether to autoload annotations using the PHP autoloader
annotations.cache string|Cache ArrayCache Doctrine\Common\Cache\Cache instance or name of a service that implements Doctrine\Common\Cache\Cache
annotations.debug bool $app['debug'] Whether the cached reader should invalidate the cache files when the PHP class with annotations changed
annotations.ignored_names string[] [] List of names that should be ignored by the annotations reader (Note: this is not supported by the SimpleAnnotationReader)

Configuring the annotations cache

By default the cache used by the annotations reader is an ArrayCache, which is probably not something you'll want to use on a production server., (*4)

If you already use a Doctrine Cache service provider and want to use an already registered cache service, set annotations.cache to the name of the service:, (*5)

// The DoctrineCacheServiceProvider will register a service named "cache"
$app->register(new DoctrineCacheServiceProvider());

// Cache annotations using the "cache" service
$app->register(new AnnotationsServiceProvider(), [
    'annotations.cache' => 'cache',
]);

Alternatively, you can override the annotations.cache service and provide your own cache provider:, (*6)

$app->register(new AnnotationsServiceProvider(), [
    'annotations.cache' => function () {
        $cache = new \Doctrine\Common\Cache\PhpFileCache(__DIR__.'/cache);
        $cache->setNamespace('annotations');

        return $cache;
    },
]);

The Versions

12/04 2017

dev-master

9999999-dev

Doctrine annotations service provider for Pimple 3.x / Silex 2.x

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pascal Luna

silex annotations doctrine provider pimple

12/04 2017

v1.0.0

1.0.0.0

Doctrine annotations service provider for Pimple 3.x / Silex 2.x

  Sources   Download

MIT

The Requires

 

The Development Requires

by Pascal Luna

silex annotations doctrine provider pimple