{% load i18n %}

{% blocktrans with 'https://github.com/getsentry/raven-php' as link %}Start by installing raven-php.{% endblocktrans %}

{% trans "Register the autoloader:" %}

require('/path/to/Raven/Autoloader.php');

Raven_Autoloader::register();

{% trans "Create an instance of the client:" %}

$client = new Raven_Client('{% if dsn %}{{ dsn }}{% else %}SENTRY_DSN{% endif %}');

{% trans "Now call out to the raven client to capture events:" %}

// {% trans "record a simple message" %}
$client->captureMessage('hello world!');

// {% trans "capture an exception" %}
try {
        throw new Exception('Uh oh!');
}
catch ($e) {
        $client->captureException($e);
}

{% trans "You can also optionally install a default error handler to catch all exceptions:" %}

$error_handler = new Raven_ErrorHandler($client);

// Register error handler callbacks
set_error_handler(array($error_handler, 'handleError'));
set_exception_handler(array($error_handler, 'handleException'));

{% blocktrans with 'https://github.com/getsentry/raven-php' as link %}For more information on other uses of Raven with PHP, please see the official documentation for raven-php.{% endblocktrans %}