Skip to content

Instantly share code, notes, and snippets.

@Jhhames
Last active May 12, 2019 21:26
Show Gist options
  • Save Jhhames/f36db23b3ef37ce11358cc707babae16 to your computer and use it in GitHub Desktop.
Save Jhhames/f36db23b3ef37ce11358cc707babae16 to your computer and use it in GitHub Desktop.
Code snippet for 'pgsql' connection when working with DATABASE_URL
<?php
$herokuDb = parse_url(env('DATABASE_URL', "postgres://uiozlihhyedqxs:f07e3c07c2cbe0a255da5fe2051bfaf9926efca2c92fa13094f1b2b58bb49ece@ec2-54-235-208-103.compute-1.amazonaws.com:5432/df4dvi3c63i7pb"));
.
.
.
'pgsql' => [
'driver' => 'pgsql',
'host' => $herokuDb['host'],
'database' => substr($herokuDb['path'], 1),
'username' => $herokuDb['user'],
'password' => $herokuDb['pass'],
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment