PHP code example of arseniew / silex-idiorm-provider

1. Go to this page and download the library: Download arseniew/silex-idiorm-provider 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/ */

    

arseniew / silex-idiorm-provider example snippets


$app->register(new \Arseniew\Silex\Provider\IdiormServiceProvider(), array(
        'idiorm.db.options' => array(
            'connection_string' => 'mysql:host=localhost;dbname=my_db',
            'username' => 'my_username',
            'password' => 'my_password',
        )
);

$app['idiorm.db']->for_table('my_table')->findMany();

$app['idiorm.dbs.options'] = array(
    'first_connection' => array(
        'connection_string' => 'mysql:host=localhost;dbname=my_db',
        'username' => 'my_username',
        'password' => 'my_password',
    ),
    'second_connection' => array(
        'connection_string' => 'sqlite:./example.db'
    )
);

$app['idiorm.dbs']['first_connection']->for_table('my_table')->findMany();
$app['idiorm.dbs']['second_connection']->for_table('other_table')->findMany();