Created
March 23, 2018 14:31
-
-
Save jasonsbarr/94e28f0d696fbcfd152b9cb44f45d661 to your computer and use it in GitHub Desktop.
PHP config for robmorgan/phinx that loads .env variables via Dotenv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * This assumes phinx.php and .env are both in the project root | |
| */ | |
| require __dir__ . '/vendor/autoload.php'; | |
| Dotenv::load(__dir__); | |
| $defaultDatabase = getenv('APP_ENV'); | |
| return [ | |
| 'paths' => [ | |
| 'migrations' => __dir__ . '/db/migrations', | |
| 'seeds' => __dir__ . 'db/seeds' | |
| ], | |
| 'environments' => [ | |
| 'default_migration_table' => 'phinxlog', | |
| 'default_database' => $defaultDatabase, | |
| $defaultDatabase => [ | |
| 'adapter' => getenv('DB_DRIVER'), | |
| 'host' => getenv('DB_HOST'), | |
| 'name' => getenv('DB_DATABASE'), | |
| 'user' => getenv('DB_USER'), | |
| 'pass' => getenv('DB_PASS'), | |
| 'port' => getenv('DB_PORT') | |
| ] | |
| ] | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment