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');
bash
make php/check   # run checks on check style
make php/fix     # run check style auto fix
bash
make php/min-compatibility # run compatibility check on current minimal version of php we support
make php/max-compatibility # run compatibility check on last version of php we will support in future