nodrew / php-airbrake-bundle
此包已被废弃,不再维护。未建议替代包。
这有助于将php-airbrake模块绑定到Symfony2包中,以便于框架中使用。
dev-master
2016-10-29 00:49 UTC
Requires
- php: >=5.3.1
- dbtlr/php-airbrake: ^1.1
Requires (Dev)
- phpunit/phpunit: ^5.6
- symfony/dependency-injection: ^2.8
- symfony/http-kernel: ^2.8
This package is not auto-updated.
Last update: 2022-02-01 12:22:23 UTC
README
这有助于将php-airbrake模块绑定到Symfony2包中,以便于框架中使用。它将自动加载异常处理器到框架中,因此所有未捕获的错误都将发送到Airbrake服务。
安装说明
使用deps(针对Symfony 2.0)
将这些块添加到以下文件中
deps
[PhpAirbrakeBundle]
git=http://github.com/nodrew/PhpAirbrakeBundle.git
target=/bundles/Nodrew/Bundle/PhpAirbrakeBundle
[php-airbrake]
git=http://github.com/nodrew/php-airbrake.git
target=/bundles/Nodrew/Bundle/PhpAirbrakeBundle/vendor/php-airbrake
app/autoload.php
$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
...
'Nodrew' => __DIR__.'/../vendor/bundles',
...
));
使用composer(针对Symfony 2.1)
安装库的最佳方式是通过使用Composer。将以下内容添加到项目根目录的composer.json
中
{ "require": { "nodrew/php-airbrake-bundle": "dev-master" } }
在Kernel中包含Bundle
app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// System Bundles
...
new Nodrew\Bundle\PhpAirbrakeBundle\PhpAirbrakeBundle(),
...
);
}
配置
app/config/config.yml
php_airbrake:
api_key: %airbrake_api_key%
api_endpoint: [optional custom API endpoint eg. http://api.airbrake.io/notifier_api/v2/notices]
queue: [optional resqueue queue name]
app/config/parameters.ini
airbrake_api_key: "airpbrake api key"
手动调用Airbrake
可以在服务容器内找到Airbrake客户端,可以使用如下方式使用它
<?php $client = $container->get('php_airbrake.client'); $client->notifyAboutError('Something really bad happened!'); $client->notifyAboutException(new Exception('Why did I catch this? It would have been caught on its own!?!'));
Resque集成
此客户端将允许通过提供要添加错误到的Resque队列名称与PHPResque集成。建议如果您想使用PHPResque与Symfony2,使用来自hlegius的PHPResqueBundle,因为它使得将工作进程与Symfony2接口变得轻松。
一旦安装并运行,只需填写队列配置变量为要使用的队列名称。我建议简单地使用类似'airbrake'的名称。假设您已为此队列运行工作进程,您应该没问题。
许可
此包受MIT许可证的约束。请参阅包中的完整许可证。
Resources/meta/LICENSE
关于
请参阅贡献者列表。
报告问题或功能请求
问题和功能请求在Github问题跟踪器中跟踪。
在报告一个错误时,将错误在用 Symfony 标准版 构建的简单项目中重现可能是个好主意,这样让扩展包的开发者通过简单地克隆它并按照一些步骤来重现问题。