Skip to content

WyskyNet/sentry-php

Repository files navigation

Sentry for PHP

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 informations needed to prioritize, identify, reproduce and fix each issue. Learn more about automatic PHP error reporting with Sentry.

Features

  • Automatically report (un)handled exceptions and errors
  • Send customized diagnostic data
  • Process and sanitize data before sending it over the network

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 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

namespace XXX;

use Sentry\ClientBuilder;

require 'vendor/autoload.php';

// Instantiate the SDK with your DSN
$client = ClientBuilder::create(['server' => 'http://[email protected]/1'])->getClient();

// Capture an exception
$eventId = $client->captureException(new \RuntimeException('Hello World!'));

// Give the user feedback
echo 'Sorry, there was an error!';
echo 'Your reference ID is ' . $eventId;

For more information, see our documentation.

Integration with frameworks

Other packages exists to integrate this SDK into the most common frameworks.

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

Tagging a Release

  1. Make sure CHANGES is up to date (add the release date) and master is green.

  2. Create a new branch for the minor version (if not present):

$ git checkout -b releases/2.1.x
  1. Update the hardcoded version tag in Client.php:
namespace Sentry;

class Client
{
    const VERSION = '2.1.0';
}
  1. Commit the change:
$ git commit -a -m "2.1.0"
  1. Tag the branch:
git tag 2.1.0
  1. Push the tag:
git push --tags
  1. Switch back to master:
git checkout master
  1. Add the next minor release to the CHANGES file:
## 2.1.0 (unreleased)
  1. Update the version in Client.php:
namespace Sentry;

class Client implements ClientInterface
{
    const VERSION = '2.1.x-dev';
}
  1. Lastly, update the composer version in composer.json:
    "extra": {
        "branch-alias": {
            "dev-master": "2.1.x-dev"
        }
    }

All done! Composer will pick up the tag and configuration automatically.

About

The official PHP SDK for Sentry (sentry.io)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.9%
  • Makefile 0.1%