<commit_before># Rollbar notifier for PHP [![Build Status](https://api.travis-ci.org/rollbar/rollbar-php.png)](https://travis-ci.org/rollbar/rollbar-php)

<!-- RemoveNext -->

This library detects errors and exceptions in your application and reports them to [Rollbar](https://rollbar.com) for alerts, reporting, and analysis.

<!-- Sub:[TOC] -->

## Quick start

```php
<?php
use \Rollbar\Rollbar;
use \Rollbar\Payload\Level;

// installs global error and exception handlers
Rollbar::init(
    array(
        'access_token' => ROLLBAR_TEST_TOKEN,
        'environment' => 'production'
    )
);

try {
    throw new \Exception('test exception');
} catch (\Exception $e) {
    Rollbar::log(Level::error(), $e);
}

// Message at level 'info'
Rollbar::log(Level::info(), 'testing info level');
<commit_msg>List supported PHP versions in the README<commit_after># Rollbar notifier for PHP [![Build Status](https://api.travis-ci.org/rollbar/rollbar-php.png)](https://travis-ci.org/rollbar/rollbar-php)

<!-- RemoveNext -->

This library detects errors and exceptions in your application and reports them to [Rollbar](https://rollbar.com) for alerts, reporting, and analysis.

Supported PHP versions: 5.3, 5.4, 5.5, 5.6, 7, and HHVM (currently tested on 3.6.6).

<!-- Sub:[TOC] -->

## Quick start

```php
<?php
use \Rollbar\Rollbar;
use \Rollbar\Payload\Level;

// installs global error and exception handlers
Rollbar::init(
    array(
        'access_token' => ROLLBAR_TEST_TOKEN,
        'environment' => 'production'
    )
);

try {
    throw new \Exception('test exception');
} catch (\Exception $e) {
    Rollbar::log(Level::error(), $e);
}

// Message at level 'info'
Rollbar::log(Level::info(), 'testing info level');

{'fraction_non_alphanumeric': 0.16453488372093023, 'fraction_numerical': 0.0069767441860465115, 'mean_word_length': 3.9312320916905446, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '581625', 'n_tokens_mistral': 573, 'n_tokens_neox': 554, 'n_words': 152}