Laravel 5.5 and lower

Rollbar SDK for Laravel 5.5 and lower

Rollbar error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's session information will be sent into Rollbar, as well as some other helpful information such as environment, server, and session.


  1. Install using composer:
composer require rollbar/rollbar-laravel 2.*
  1. Add Project Access Token post_server_item from → Settings → Project Access Tokens to .env:

Conditional loading

If you wish to load the SDK conditionally:

  1. Add the dont-discover clause in your app's composer.json:
    "extra": {
        "laravel": {
            "dont-discover": [
  1. Instead of adding the service provider in the providers array in config/app.php as displayed above, load it in your AppServiceProvider:
class AppServiceProvider extends ServiceProvider
    public function register()
        if ($this->app->environment(['staging', 'production'])) {


This package will automatically send to Rollbar every logged message whose level is higher than the ROLLBAR_LEVEL you have configured.

Logging a Specific Message

You can log your own messages anywhere in your app. For example, to log a debug message:

\Log::debug('Here is some debug information');

Adding Context Information

You can pass user information as context like this:

\Log::error('Something went wrong', [
    'person' => ['id' =>(string) 123, 'username' => 'John Doe', 'email' => '[email protected]']

Or pass some extra information:

\Log::warning('Something went wrong', [
    'download_size' => 3432425235

Exception Logging

Laravel 5 to 5.5

NOTE: Fatal exceptions will always be sent to Rollbar.

Any exceptions that are not listed as $dontReport in your app/Exceptions/Handler.php or its parent will be sent to Rollbar automatically.

If you wish to override this to do more Rollbar reporting, you may do so using the Log facade in your error handler in app/Exceptions/Handler.php. For example, to log every exception add the following:

public function report(Exception $exception)
    return parent::report($exception);

Laravel 4

For Laravel 4 installations, this is located in app/start/global.php:

App::error(function(Exception $exception, $code)


Setting up ROLLBAR_TOKEN in .env should be enough for basic configuration.

This package supports configuration through the services configuration file located in config/services.php. All rollbar configuration variables will be directly passed to Rollbar:

'rollbar' => [
    'access_token' => env('ROLLBAR_TOKEN'),
    'level' => env('ROLLBAR_LEVEL'),

Asynchronous Reporting

By default, payloads (batched or not) are sent as part of script execution. This is easy to configure but may negatively impact performance. With some additional setup, payloads can be written to a local relay file instead; that file will be consumed by rollbar-agent asynchronously. To turn this on, set the following config params:

$config = array(
  // ... rest of current config
  'handler' => 'agent',
  'agent_log_location' => '/var/www'  // not including final slash. must be writeable by the user php runs as.

You'll also need to run the agent. See the rollbar-agent docs for setup instructions.

Centralized Log Aggregation with fluentd

If you have a fluentd instance running available you can forward payloads to this instance. To turn this on, set the following config params.

$config = array(
  // ... rest of current config
  'handler' => 'fluent',
  'fluent_host' => 'localhost',  // localhost is the default setting but any other host IP or a unix socket is possible
  'fluent_port' => 24224, // 24224 is the default setting, please adapt it to your settings
  'fluent_tag' => 'rollbar', // rollbar is the default setting, you can adjust it to your needs

Also, you will have to install a suggested package fluent/logger.

Configuration Reference

See the Rollbar-PHP Configuration Reference

Help / Support

If you run into any issues, please email us at [email protected]

For bug reports, please open an issue on GitHub.


For more information on rollbar-php, please see the docs here.