PHPackages                             jeanfprado/metrics - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. jeanfprado/metrics

ActiveLibrary[API Development](/categories/api)

jeanfprado/metrics
==================

API Metrics where you can create metrics using a API.

0.1.0(3y ago)06MITPHPPHP ^7.3|^8.0|^8.1

Since Apr 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jeanfprado/metrics)[ Packagist](https://packagist.org/packages/jeanfprado/metrics)[ Docs](https://github.com/jeanfprado/metrics)[ RSS](/packages/jeanfprado-metrics/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

What is metric?
---------------

[](#what-is-metric)

Metrics is a PHP (Laravel) library to handle all the metrics in your application. It support a value metric and they allow to be loaded over AJAX with a nice loading animation.

It uses a simple API to create all the JS logic for you. You just need to write a few PHP lines :)

[![](metrics.gif)](metrics.gif)

Installation
------------

[](#installation)

You can pull in the package via composer:

```
composer require jeanfprado/metrics
```

The package will automatically register itself.

Configuration
-------------

[](#configuration)

### Laravel without auto-discovery:

[](#laravel-without-auto-discovery)

If you don't use auto-discovery, add the MetricServiceProvider to the providers array in config/app.php

```
Jeanfprado\Metric\MetricServiceProvider::class,
```

### Copy the package config to your local config with the publish command:

[](#copy-the-package-config-to-your-local-config-with-the-publish-command)

```
php artisan vendor:publish --provider="Jeanfprado\Metric\MetricServiceProvider"
```

Creating a Metric
-----------------

[](#creating-a-metric)

```
php artisan metric:value TotalUsers
```

Configure a new metric to use: `config/metrics.php`

```
    'classes' => [
        App\Metrics\TotalUsers
    ],
```

Example Value Metrics

```
