websk / php-db
There is no license information available for the latest version (1.3.2) of this package.
DB Service
1.3.2
2022-03-16 16:10 UTC
Requires
- php: ^7.4
- ext-pdo: *
- ulrichsg/getopt-php: ^3.0
- websk/php-config: 1.0.*
- websk/php-utils: 1.0.*
README
Configuration example
$config = [
'settings' => [
'db' => [
'db_skif' => [
'host' => 'mysql',
'db_name' => 'skif',
'user' => 'root',
'password' => 'root',
]
]
]
];
Registering a service
$container->set('DB_SERVICE_CONTAINER_ID', function (ContainerInterface $container) {
$settings = $container->get('settings');
$db_config = $settings['db']['db_skif'];
return new DBServiceFactory::factoryMySQL($db_config);
});
Use DBWrapper
Set DBWrapper db service in App
DBWrapper::setDbService($container->get('DB_SERVICE_CONTAINER_ID'));