{ "html": "
\n

Installation

\n

There are various ways to install the PHP integration for Sentry. The\nrecommended way is to use Composer:

\n
$ composer require "sentry/sentry"\n
\n
\n

Alternatively you can manually install it:

\n
    \n
  1. Download and extract the latest sentry-php archive\nto your PHP project.

    \n
  2. \n
  3. Require the autoloader in your application:

    \n
    require_once '/path/to/Raven/library/Raven/Autoloader.php';\nRaven_Autoloader::register();\n
    \n
    \n
  4. \n
\n
\n\n\n
\n

Configuration

\n

The most important part is the creation of the raven client. Create it\nonce and reference it from anywhere you want to interface with Sentry:

\n
$client = new Raven_Client('___DSN___');\n
\n
\n

Once you have the client you can either use it manually or enable the\nautomatic error and exception capturing which is recommended:

\n
$error_handler = new Raven_ErrorHandler($client);\n$error_handler->registerExceptionHandler();\n$error_handler->registerErrorHandler();\n$error_handler->registerShutdownFunction();\n
\n
\n
\n\n\n
\n

Capturing Errors

\n

Sentry includes basic functionality for reporting any uncaught\nexceptions or PHP errors. This is done via the error handler,\nand appropriate hooks for each of PHP’s built-in reporting:

\n
$error_handler = new Raven_ErrorHandler($sentryClient);\n$error_handler->registerExceptionHandler();\n$error_handler->registerErrorHandler();\n$error_handler->registerShutdownFunction();\n
\n
\n
\n

Note

\n

Calling install() on a Raven_Client instance will automatically\nregister these handlers.

\n
\n
\n", "link": "https://docs.getsentry.com/clients/php/", "id": "php", "name": "PHP" }