herrera-io / silex-pdo
This package is abandoned and no longer maintained.
No replacement package was suggested.
A simple PDO service provider.
1.2.1
2013-11-26 17:05 UTC
Requires
- php: >=5.3.3
- herrera-io/pdo-log: ~1.0
- silex/silex: 1.*
Requires (Dev)
- herrera-io/phpunit-test-case: ~1.0
- monolog/monolog: ~1.1
- phpunit/phpunit: ~3.7
This package is not auto-updated.
Last update: 2021-12-07 01:37:09 UTC
README
A simple PDO service provider.
Summary
A stupid simple PDO service provider. I cannot get any more clear than this.
Installation
Add it to your list of Composer dependencies:
$ composer require "herrera-io/silex-pdo=1.*"
Usage
use Herrera\Pdo\PdoServiceProvider; use Silex\Application; $app = new Application(); $app->register( new PdoServiceProvider(), array( 'pdo.dsn' => 'pdo_mysql:dbname=test;host=127.0.0.1', 'pdo.username' => 'username', // optional 'pdo.password' => 'password', // optional 'pdo.options' => array( // optional PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'" ) ) ); $pdo = $app['pdo'];
You can also use the PdoTrait
to add a prepare
method to your application:
use Herrera\Pdo\PdoTrait; use Silex\Application; class MyApp extends Application { use PdoTrait; }
You will still need to register the service provider.
If debugging is enabled and Monolog is available, a logging version
of PDO
will be used to log queries and their execution time.