balt-technologies/newrelic-metrics

There is no license information available for the latest version (0.1.0) of this package.

0.1.0 2020-12-18 12:08 UTC

This package is auto-updated.

Last update: 2024-04-18 23:25:12 UTC


README

Installation

You can install the php package using composer.

composer require balt-technologies/newrelic-metrics

That's is.

Requirements

You need to have to install the new relic PHP extension.

Report a metric

$newRelic = new NewRelic();
    
$newRelic->report((new FormMetric())->created(1));

Create a metric

use Balt\NewRelic\Metric;

class FormMetric implements Metric
{
    private array $attributes;

    public function __construct()
    {
        $this->attributes = [];
    }

    public function created(int $createdForms = 1): self
    {   
        $this->attributes['created'] = $createdForms;

        return $this;
    }


    public function getName(): string
    {
        return 'forms';
    }

    public function getAttributes(): array
    {
        return $this->attributes;
    }
}