intouch/newrelic

NewRelic PHP Agent 的命名空间包装器

v2.0.0 2019-01-26 23:44 UTC

This package is auto-updated.

Last update: 2024-08-27 13:20:50 UTC


README

Build Status Coveralls Latest Version on Packagist Total Downloads StyleCI

NewRelic PHP Agent API 包装器

这是一个简单的中继包装器,通过 composer 可在命名空间类中访问 NewRelic PHP Agent API。这里没有魔法。

安装

运行

$ composer require intouch/newrelic

基本用法

最基本的使用是简单地包含该类

use Intouch\Newrelic\Newrelic;

$newrelic = new Newrelic();

这将加载该类,如果 NewRelic 代理已安装,则可以访问 API。如果没有安装代理,它将简单地作为中继器运行并从所有方法返回 false

如果您想在 NewRelic 代理无法加载时收到通知,将 true 传递给构造函数

use Intouch\Newrelic\Newrelic;

$newrelic = new Newrelic(true);

如果找不到代理 API,现在将抛出 RuntimeException