I’ve been doing a lot of database stuff lately, and not much PHP,
so when I returned to make my first Laravel project for a
while, I had to check the docs to remind myself how some of this
works. I noticed that the default approach to database
credentials is still to use separate credentials for the host,
port, and other variables. I’m using Aiven databases (because I work there and
managed databases are great for demo apps as well as real ones!)
which supply connection strings, but Laravel supports these too.
For MySQL, the database connection string from Aiven is in the
format:
mysql://username:password@hostname:port/dbname
You can remove the configuration for DB_* and
instead use the variable DATABASE_URL with the full
string.
Pro-tip: Laravel’s built …
[Read more]