LaraLens: a Laravel command for checking configuration

Roberto Butti
3 min readMay 30, 2020
LaraLens: Laravel artisan command to inspect configuration and runtime parameters

LaraLens is a Laravel Artisan Command to show you the current configuration of your application. It is useful to show in your terminal the status of:

  • some useful configuration variable;
  • the connection to the database;
  • the tables in the database;
  • the connection via HTTP request.

Why?

Some parameters and configuration listed by LaraLens

When I have a new Laravel Application deployed on the target server, usually I perform a list of commands in order to check the configuration, the connection to database, inspect some tables, and inspect the response of the web server. With this package named LaraLens, I tried to show more information in just one command. This is useful also when the installation of your Laravel application is on premises, and someone else takes care about the configuration on the target server. So, in this scenario usually, as developer, your first question is: “how is configured the application on the production (or stage) environment?”.

Installation

In your Laravel application, you can install the package via composer:

composer require hi-folks/lara-lens

Usage

php artisan laralens:diagnostic

Usage: control the database connection

You can see database connection informations, you can choose which table you want to inspect, and the column used for the “order by” (default created_at):

php artisan laralens:diagnostic --table=migrations --column-sort=id

To retrieve the last user (last by creation date):

php artisan laralens:diagnostic --table=users --column-sort=created_at

To retrieve the last user (last by update date):

php artisan laralens:diagnostic --table=users --column-sort=updated_at

Usage: control the output

You can control the output via the show option. You can define:

  • config
  • connection
  • database
  • runtime
  • migration
  • all The defalut for — show option is all.
php artisan laralens:diagnostic --show=config --show=connection --show=database --show=runtime --show=migration

If you want to see only database information:

php artisan laralens:diagnostic --show=database

LaraLens provides some hints

If you have some coonfiguration issues ono your configuration, for example:wrong parameters for database connectio or wrong parameters for application URLs, LaraLens catch the error and suggest to the user sme hints in order to fix the configuration.

LaraLens detects a database connection issues and suggest where to focus and show the current configuration used

References

--

--

Roberto Butti

I’m technophile. Vuejs and Laravel enthusiast! #vuejs #laravel. I love #coding