sentry/sentry

A PHP SDK for Sentry (http://sentry.io)

Installs: 10 822 884

Dependents: 169

Suggesters: 23

Stars: 983

Watchers: 58

Forks: 295

Open Issues: 32


README

68747470733a2f2f73656e7472792d6272616e642e73746f726167652e676f6f676c65617069732e636f6d2f73656e7472792d6c6f676f2d626c61636b2e706e67

Sentry for PHP

Build Status AppVeyor Build Status Total Downloads Monthly Downloads Latest Stable Version License Scrutinizer Code Quality Code Coverage

The Sentry PHP error reporter tracks errors and exceptions that happen during the execution of your application and provides instant notification with detailed information needed to prioritize, identify, reproduce and fix each issue.

Notice 2.0

The current master branch is our new major release of the SDK 2.0. We currently ship 2.0 with the beta tag, which means you have to install it by exactly providing the version otherwise you wont get 2.0. We will drop the beta tag as soon as we do no longer expect any public API changes.

Install

To install the SDK you will need to be using Composer in your project. To install it please see the docs.

Sentry PHP is not tied to any specific library that sends HTTP messages. Instead, it uses Httplug to let users choose whichever PSR-7 implementation and HTTP client they want to use.

If you just want to get started quickly you should run the following command:

php composer.phar require sentry/sentry:2.0.0-beta1 php-http/curl-client guzzlehttp/psr7

This will install the library itself along with an HTTP client adapter that uses cURL as transport method (provided by Httplug) and a PSR-7 implementation (provided by Guzzle). You do not have to use those packages if you do not want to. The SDK does not care about which transport method you want to use because it's an implementation detail of your application. You may use any package that provides php-http/async-client-implementation and http-message-implementation.

Usage

use function Sentry\init;
use function Sentry\captureException;

init(['dsn' => '___PUBLIC_DSN___' ]);

try {
    thisFunctionThrows(); // -> throw new \Exception('foo bar');
} catch (\Exception $exception) {
    captureException($exception);
}

Official integrations

The following integrations are fully supported and maintained by the Sentry team.

3rd party integrations

The following integrations are available and maintained by members of the Sentry community.

Community

Contributing

Dependencies are managed through composer:

$ composer install

Tests can then be run via phpunit:

$ vendor/bin/phpunit