PHP code example of faraztanveer / multi-db

1. Go to this page and download the library: Download faraztanveer/multi-db 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/ */

    

faraztanveer / multi-db example snippets


// Access the multidb instance
$db = app('multidb');

// Shift to a new database connection
$db->shift('new_database', 'new_host', 'new_username', 'new_password', 'new_port');

$db->setDefaultDb();

$db->currentDb();
bash
php artisan vendor:publish --provider="MultiDB\MultiDBServiceProvider"
bash
php artisan multidb:migrate --database=your_database --path=path/to/migrations --host=127.0.0.1 --username=root --password=your_password --port=3306