How to use multiple database in Lumen
We've using Lumen for building API's , Now we need to access multiple databases. Currently using .env for database config but unable to found the way to multiple databases in .env where we need to read 2nd connection ... First, you'll need to configure your connections. If you don't already have one you'll need to create a config directory in your project and add the file config/database.php . It might look like this: <?php return [ 'default' => 'accounts', 'connections' => [ 'mysql' => [ 'driver' => 'mysql', 'host' => env('DB_HOST'), 'port' => env('DB_PORT'), 'database' => env('DB_DATABASE'),