PHP code example of eureka / component-database
1. Go to this page and download the library: Download eureka/component-database 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/ */
eureka / component-database example snippets
use Eureka\Component\Database\ConnectionFactory;
$factory = new ConnectionFactory(
[
'common' => [
'dsn' => 'mysql:dbname=my_database;host=localhost;charset=UTF8',
'user' => 'user',
'password' => 'pass',
'options' => null,
],
]
);
$connection = $factory->getConnection('common');
$connection->query('SELECT * FROM my_table');