PHP code example of codememory / database-connection
1. Go to this page and download the library: Download codememory/database-connection library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
codememory / database-connection example snippets
use Codememory\Components\Database\Connection\Connection;
use Codememory\Components\Database\Connection\Interfaces\ConnectorConfigurationInterface;
use Codememory\Components\Database\Connection\Drivers\MySQLDriver;
ation) {
$configuration
->host('localhost')
->dbname('dbname')
->username('username')
->password('user password')
->driver(new MySQLDriver())
});
// Возьмем ранее добавленный коннектор "connector-name"
$connection->reconnect('connector-name', function (ConnectorConfigurationInterface $configuration) {
$configuration->dbname('new-dbname');
});
$connection
->getConnector('connector-name')
->getConnectorData()
->getDbname(); // new-dbname