1. Go to this page and download the library: Download stechstudio/laravel-metrics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
class OrderReceived {
protected $order;
public function __construct($order)
{
$this->order = $order;
}
}
use STS\Metrics\Contracts\ShouldReportMetric;
class OrderReceived implements ShouldReportMetric {
use STS\Metrics\Contracts\ShouldReportMetric;
use STS\Metrics\Traits\ProvidesMetric;
class OrderReceived implements ShouldReportMetric {
use ProvidesMetric;
class OrderReceived implements ShouldReportMetric {
use ProvidesMetric;
protected $metricName = "new_order";
protected $metricTags = ["category" => "revenue"];
...
public function getMetricValue()
{
return $this->order->total;
}
use STS\Metrics\Contracts\ShouldReportMetric;
use STS\Metrics\Metric;
class OrderReceived implements ShouldReportMetric {
protected $order;
public function __construct($order)
{
$this->order = $order;
}
public function createMetric()
{
return (new Metric('order_received'))
->setValue(...)
->setTags([...])
->setTimestamp(...)
->setResolutions(...);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.