Pomm Service Provider
This package contains a Pomm ServiceProvider for the Silex micro-framework., (*1)
Installation
To install this library, run the command below:, (*2)
composer require pomm-project/pomm-service-provider ~2.0@dev
And enable it in your application:, (*3)
<?php
use PommProject\Silex\ServiceProvider as PommProvider;
// …
$app->register(new PommProvider\PommServiceProvider(),
[
'pomm.configuration' =>
[
'my_db1' => ['dsn' => 'pgsql://user:pass@host:port/db_name'],
'my_db2' =>
[
'dsn' => … ,
'class:session_builder' => '\PommProject\ModelManager\SessionBuilder',
],
…
],
'pomm.logger.service' => 'monolog', // default
]
);
This package also contain a PommProfilerServiceProvider
to be used with the WebProfileProvider
., (*4)
<?php
use PommProject\Silex\ServiceProvider as PommProvider;
// …
$app->register(new PommProvider\PommProfilerServiceProvider());
If you want to use the ModelManager
package, be sure to specify either the model manager SessionBuilder
or, better: your project session builder., (*5)
Usage
<?php
// …
$iterator = $app['pomm']['my_db']
->getQueryManager()
->query('select …', ['param1', 'param2', … ]);
Check out, (*6)