websk / php-db
There is no license information available for the latest version (2.1.0) of this package.
DB Service
2.1.0
2025-03-25 05:30 UTC
Requires
- php: ^8.3
- ext-pdo: *
- ulrichsg/getopt-php: ^v4.0.4
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) {
$db_config = $container->get(
'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'));