PHPackages                             gfilipiak/raven - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. gfilipiak/raven

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

gfilipiak/raven
===============

A PHP client for Sentry (http://getsentry.com)

0.7.1(12y ago)016BSDPHPPHP &gt;=5.2.4

Since Feb 1Pushed 10y ago2 watchersCompare

[ Source](https://github.com/gfilipiak/raven-php)[ Packagist](https://packagist.org/packages/gfilipiak/raven)[ Docs](http://getsentry.com)[ RSS](/packages/gfilipiak-raven/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

raven-php
=========

[](#raven-php)

[![https://secure.travis-ci.org/getsentry/raven-php.png?branch=master](https://camo.githubusercontent.com/f92cb9bd1e4fab45db908406126f7c5b81b750704d42d22ae317ab3030d325c2/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f67657473656e7472792f726176656e2d7068702e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/getsentry/raven-php)raven-php is a PHP client for [Sentry](http://aboutsentry.com/).

```
// Instantiate a new client with a compatible DSN
$client = new Raven_Client('http://public:secret@example.com/1');

// Capture a message
$event_id = $client->getIdent($client->captureMessage('my log message'));
if ($client->getLastError() !== null) {
    printf('There was an error sending the event to Sentry: %s', $client->getLastError());
}

// Capture an exception
$event_id = $client->getIdent($client->captureException($ex));

// Provide some additional data with an exception
$event_id = $client->getIdent($client->captureException($ex, array(
    'extra' => array(
        'php_version' => phpversion()
    ),
)));

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

// Install error handlers and shutdown function to catch fatal errors
$error_handler = new Raven_ErrorHandler($client);
$error_handler->registerExceptionHandler();
$error_handler->registerErrorHandler();
$error_handler->registerShutdownFunction();
```

Installation
------------

[](#installation)

### Install with Composer

[](#install-with-composer)

If you're using [Composer](https://getcomposer.org/) to manage dependencies, you can add Raven with it.

```
$ composer require raven/raven:$VERSION
```

(replace `$VERSION` with one of the available versions on [Packagist](https://packagist.org/packages/raven/raven)) or to get the latest version off the master branch:

```
$ composer require raven/raven:dev-master
```

Note that using unstable versions is not recommended and should be avoided. Also you should define a maximum version, e.g. by doing `>=0.6, array(
    'php_version' => phpversion(),
)
```

### `curl_method`

[](#curl_method)

Defaults to 'sync'.

Available methods:

- sync (default): send requests immediately when they're made
- async: uses a curl\_multi handler for best-effort asynchronous submissions
- exec: asynchronously send events by forking a curl process for each item

### `curl_path`

[](#curl_path)

Defaults to 'curl'.

Specify the path to the curl binary to be used with the 'exec' curl method.

### `trace`

[](#trace)

Set this to `false` to disable reflection tracing (function calling arguments) in stacktraces.

### `logger`

[](#logger)

Adjust the default logger name for messages.

Defaults to `php`.

### `ca_cert`

[](#ca_cert)

The path to the CA certificate bundle.

Defaults to the common bundle which includes getsentry.com: ./data/cacert.pem

Caveats:

- The CA bundle is ignored unless curl throws an error suggesting it needs a cert.
- The option is only currently used within the synchronous curl transport.

### `curl_ssl_version`

[](#curl_ssl_version)

The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually.

### `message_limit`

[](#message_limit)

Defaults to 1024 characters.

This value is used to truncate message and frame variables. However it is not guarantee that length of whole message will be restricted by this value.

### `processors`

[](#processors)

An array of classes to use to process data before it is sent to Sentry. By default, Raven\_SanitizeDataProcessor is used

### `processorOptions`

[](#processoroptions)

Options that will be passed on to a setProcessorOptions() function in a Raven\_Processor sub-class before that Processor is added to the list of processors used by Raven\_Client

An example of overriding the regular expressions in Raven\_SanitizeDataProcessor is below:

```
'processorOptions' => array(
    'Raven_SanitizeDataProcessor' => array(
                'fields_re' => '/(user_password|user_token|user_secret)/i',
                'values_re' => '/^(?:\d[ -]*?){15,16}$/'
            )
)
```

Providing Request Context
-------------------------

[](#providing-request-context)

Most of the time you're not actually calling out to Raven directly, but you still want to provide some additional context. This lifecycle generally constists of something like the following:

- Set some context via a middleware (e.g. the logged in user)
- Send all given context with any events during the request lifecycle
- Cleanup context

There are three primary methods for providing request context:

```
// bind the logged in user
$client->user_context(array('email' => 'foo@example.com'));

// tag the request with something interesting
$client->tags_context(array('interesting' => 'yes'));

// provide a bit of additional context
$client->extra_context(array('happiness' => 'very'));
```

If you're performing additional requests during the lifecycle, you'll also need to ensure you cleanup the context (to reset its state):

```
$client->context->clear();
```

Contributing
------------

[](#contributing)

First, make sure you can run the test suite. Install development dependencies :

```
$ composer install
```

You may now use phpunit :

```
$ vendor/bin/phpunit
```

Resources
---------

[](#resources)

- [Bug Tracker](http://github.com/getsentry/raven-php/issues)
- [Code](http://github.com/getsentry/raven-php)
- [Mailing List](https://groups.google.com/group/getsentry)
- IRC (irc.freenode.net, #sentry)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Recently: every ~59 days

Total

9

Last Release

4617d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/781cadd93447814872451d16a11e92f96e8693f0cb2564b59991e0159d011d25?d=identicon)[gfilipiak](/maintainers/gfilipiak)

---

Top Contributors

[![dcramer](https://avatars.githubusercontent.com/u/23610?v=4)](https://github.com/dcramer "dcramer (309 commits)")[![localheinz](https://avatars.githubusercontent.com/u/605483?v=4)](https://github.com/localheinz "localheinz (16 commits)")[![mvantellingen](https://avatars.githubusercontent.com/u/245297?v=4)](https://github.com/mvantellingen "mvantellingen (11 commits)")[![GromNaN](https://avatars.githubusercontent.com/u/400034?v=4)](https://github.com/GromNaN "GromNaN (9 commits)")[![jeromemacias](https://avatars.githubusercontent.com/u/582446?v=4)](https://github.com/jeromemacias "jeromemacias (9 commits)")[![msabramo](https://avatars.githubusercontent.com/u/305268?v=4)](https://github.com/msabramo "msabramo (7 commits)")[![mitsuhiko](https://avatars.githubusercontent.com/u/7396?v=4)](https://github.com/mitsuhiko "mitsuhiko (5 commits)")[![JonathanO](https://avatars.githubusercontent.com/u/1206546?v=4)](https://github.com/JonathanO "JonathanO (5 commits)")[![mattrobenolt](https://avatars.githubusercontent.com/u/375744?v=4)](https://github.com/mattrobenolt "mattrobenolt (4 commits)")[![madssj](https://avatars.githubusercontent.com/u/22311?v=4)](https://github.com/madssj "madssj (3 commits)")[![mgrinko](https://avatars.githubusercontent.com/u/3237782?v=4)](https://github.com/mgrinko "mgrinko (3 commits)")[![m8rge](https://avatars.githubusercontent.com/u/575777?v=4)](https://github.com/m8rge "m8rge (3 commits)")[![siwinski](https://avatars.githubusercontent.com/u/1034024?v=4)](https://github.com/siwinski "siwinski (3 commits)")[![thomasbachem](https://avatars.githubusercontent.com/u/231538?v=4)](https://github.com/thomasbachem "thomasbachem (3 commits)")[![dknecht](https://avatars.githubusercontent.com/u/58620?v=4)](https://github.com/dknecht "dknecht (3 commits)")[![viperfx](https://avatars.githubusercontent.com/u/328257?v=4)](https://github.com/viperfx "viperfx (2 commits)")[![asuth](https://avatars.githubusercontent.com/u/46909?v=4)](https://github.com/asuth "asuth (2 commits)")[![eduardosoliv](https://avatars.githubusercontent.com/u/2790643?v=4)](https://github.com/eduardosoliv "eduardosoliv (2 commits)")[![fabpot](https://avatars.githubusercontent.com/u/47313?v=4)](https://github.com/fabpot "fabpot (2 commits)")[![gfilipiak](https://avatars.githubusercontent.com/u/2045903?v=4)](https://github.com/gfilipiak "gfilipiak (2 commits)")

---

Tags

loglogging

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gfilipiak-raven/health.svg)

```
[![Health](https://phpackages.com/badges/gfilipiak-raven/health.svg)](https://phpackages.com/packages/gfilipiak-raven)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.5k](/packages/symfony-monolog-bundle)[sentry/sentry

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

1.9k227.1M271](/packages/sentry-sentry)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[rap2hpoutre/laravel-log-viewer

A Laravel log reader

3.2k14.7M70](/packages/rap2hpoutre-laravel-log-viewer)[sentry/sdk

This is a meta package of sentry/sentry. We recommend using sentry/sentry directly.

327134.8M151](/packages/sentry-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
