To get the database connection parameters (server, username, password, etc.), if you use MySQL, you can do this:
echo "Driver: " . Config::get('database.connections.mysql.driver') . "<br/>\r\n"; echo "Host: " . Config::get('database.connections.mysql.host') . "<br/>\r\n"; echo "Database: " . Config::get('database.connections.mysql.database') . "<br/>\r\n"; echo "Username: " . Config::get('database.connections.mysql.username') . "<br/>\r\n"; echo "Password: " . Config::get('database.connections.mysql.password') . "<br/>\r\n";
On my local development machine, this gives:
Driver: mysql
Host: localhost
Database: local_dev_db
Username: root
Password: not-my-real-pwd
... Obviously, you should never show your password (or any of these other details) in your direct application! But if this is only for your information on the local development machine, you should be fine.
If you are not using MySQL, just replace mysql with sqlite or pgsql or something else.
source share