Giter Club home page Giter Club logo

larametrics's Introduction

Larametrics

Current Version License Build Status Total Downloads

A self-hosted metrics and notifications platform for Laravel apps, Larametrics records and notifies you of changes made to models, incoming requests, and messages written to the log.

A full version of the docs can be found here, below you'll find a quick 'Getting Started' guide.

Screenshot of Larametrics Dashboard

Requirements

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

Installation

Larametrics is installed as a standalone package through 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

Note: Notifications use queued jobs when available to prevent delays in app response time. If you don't have this database table set up already for queues, run php artisan queue:table && php artisan migrate.

Displaying the Dashboard

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();

Include that where (and how) you want the dashboard to appear. For reference, all Larametrics routes are wrapped under a /metrics prefix, but you can adjust where you want the routes to appear.

In the following example, the Larametrics dashboard will only be viewable to people who are signed into the application, and visit /admin/metrics:

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

Configuration

Configuring Larametrics for use within your Laravel app takes place mainly in the config/larametrics.php file. Each item is broken down in the comment lines above it, describing what that item does and what value(s) it's anticipating.

There are also two .env variables you'll need to set depending on if you use notifications:

  • LARAMETRICS_NOTIFICATION_EMAIL, the address that all email notifications will be routed to
  • LARAMETRICS_NOTIFICATION_SLACK_WEBHOOK, a Slack webhook configured for receiving requests and adding messages to a specified channel. More info here.

Difference to Laravel Telescope

In October 2018, Taylor Otwell announced Laravel Telescope, which acts as a debugging tool for Laravel applications. For a distinction between Larametrics and Telescope, please see this discussion here.

Contact Info

Have an issue? Submit it here! Want to get in touch? Feel free to reach out to me on Twitter for any kind of general questions or comments.

License

The MIT License (MIT). See LICENSE.md for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.