for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Darya\Service\Provider;
use Darya\Database\Connection\MySql;
use Darya\Database\Factory;
use Darya\Service\Contracts\Container;
use Darya\Service\Contracts\Provider;
/**
* A service provider that provides a MySQL connection using the configuration
* registered with the service container.
*
* @author Chris Andrew <[email protected]>
*/
class MySqlService implements Provider
{
public function register(Container $container)
$container->register(array(
'Darya\Database\Connection' => function ($container) {
$config = $container->config;
$connection = new MySql(
$config['database.hostname'],
$config['database.username'],
$config['database.password'],
$config['database.database']
);
$connection->setEventDispatcher($container->event);
return $connection;
}
));