DEV Community

Cover image for LaraLens a Laravel command for inspecting configuration
Roberto B.
Roberto B.

Posted on ā€¢ Edited on

1 2

LaraLens a Laravel command for inspecting configuration

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 database connection;
  • the tables in the database;
  • the connection via HTTP request.

Alt Text

Why?

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, the response of the web server. 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. So, in this scenario usually, as developer, your first question is: "how is configured the application?".

Installation

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

composer require hi-folks/lara-lens
Enter fullscreen mode Exit fullscreen mode

Usage

php artisan laralens:diagnostic
Enter fullscreen mode Exit fullscreen mode

Executing Laralens to inspect your Laravel application

Usage: control the database connection

You can see database connection information, and you can choose the table to check, and the column used for the "order by" (default created_at):

php artisan laralens:diagnostic --table=migrations --column-sort=id
Enter fullscreen mode Exit fullscreen mode

To retrieve the latest user (creation date):

php artisan laralens:diagnostic --table=users --column-sort=created_at
Enter fullscreen mode Exit fullscreen mode

To take the latest user (update date):

php artisan laralens:diagnostic --table=users --column-sort=updated_at
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If you want to see only database information:

php artisan laralens:diagnostic --show=database
Enter fullscreen mode Exit fullscreen mode

References

Github repository

GitHub logo Hi-Folks / lara-lens

Laravel package for display diagnostic (config, database, http connections...)

Packagist

The Packagist page is: https://packagist.org/packages/hi-folks/lara-lens

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

šŸ‘‹ Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay