Skip to content

Instantly share code, notes, and snippets.

@stefanotorresi
Created January 13, 2014 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanotorresi/8399139 to your computer and use it in GitHub Desktop.
Save stefanotorresi/8399139 to your computer and use it in GitHub Desktop.
ZF2 ServiceManager config example
<?php
return [
'factories' => [
'Db' => function ($sm) {
$dbConfig = $sm->get('db_config');
$db = new PDO(
$dbConfig['dsn'],
$dbConfig['user'],
$dbConfig['pass'],
$dbConfig['driver_options']
);
return $db;
},
],
'services' => [
'db_config' => [
'dsn' => 'dsn:foo=bar;baz=bat',
'user' => 'johndoe',
'pass' => 'secret',
'driver_options' => [],
],
],
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment