Larametrics: a self-hosted metrics and notifications platform for Laravel apps.

Larametrics is an open-source self-hosted metrics and notifications platform for Laravel apps.

Larametrics is a self-hosted metrics and notifications platform for Laravel apps. It keeps an eye on model changes, log entries, and route requests, Larametrics alerts you through email or Slack when one of your notification triggers is met.

Some example notifications might be:

  • Email me when a notice or info message is logged
  • Alert me through Slack and email when an error is logged
  • Let me know when an Admin model is created or deleted
  • Tell me when someone visits the /auth/login route

In addition to notifications, a clean and responsive dashboard is provided thanks to Tabler that displays all of the model changes, log entries, and route requests stored since you installed Larametrics.

 

Screenshot of the Larametrics Dashboard

 

Install

Larametrics requires

  • PHP 5.6.4 or higher
  • Laravel 5.2 or higher
  • guzzlehttp/guzzle (if notifications enabled)

run this command to install Larametrics via composer:

composer require aschmelyun/larametrics

 

After Composer finishes up, you'll have to add the following line to your config/app.php file if you're not on Laravel 5.5 or higher:

Aschmelyun\Larametrics\LarametricsServiceProvider::class

 

Additionally, you'll want to get the config file copied over and add in the necessary database structure with:

php artisan vendor:publish --provider="Aschmelyun\Larametrics\LarametricsServiceProvider"
php artisan migrate

 

Once you have the package tied in to your Laravel app, it starts collecting data based off of the default config file and storing it in your database. In order to view the dashboard associated with Larametrics and analyse your metrics and notifications, you'll need to add in a helper method to your routes file of choice.

\Aschmelyun\Larametrics\Larametrics::routes();

 

In the following simple example, the Larametrics dashboard and all routes associated with it will only be viewable to users who are signed in (authenticated) to the application. When one of those users visits /admin/metrics, they'll have the main dashboard view presented to them.

// routes/web.php
Route::group(['middleware' => 'auth', 'prefix' => 'admin'], function() {
    \Aschmelyun\Larametrics\Larametrics::routes();
});

 

Thanks for reading this post and feel free to share with us your opinion or any suggestion about another Laravel package for monitoring laravel web apps.

Tags :