Blog |

Improved PHP error reporting with our latest rollbar-php 1.0 updates

Improved PHP error reporting with our latest rollbar-php 1.0 updates
Table of Contents

We are excited to announce a significant upgrade to our PHP notifier SDK. This new version will make it much easier for customers to integrate their PHP apps with Rollbar. It uses the latest standards like Composer, proper namespaces, and is more reliable. Here are some of the highlights:

Our first major 1.0 release

This major release of our PHP SDK represents a significant update in architecture, style, and quality for our PHP notifier. In addition, many outstanding issues were fixed so 1.0 is more reliable and better tested than our prior versions.

Our prior version, 0.18.2, was written in an old style of PHP with most of the code living in a single file. This was due to our desire to support the oldest version of PHP possible. Due to the changing landscape over the past couple years, it became reasonable to drop support for PHP 5.2 and this opened the door for many language features which benefit both our code and yours.

While the interface has undergone a redesign, it is still backward compatible with 0.18.2 via convenience functions.

Support for Composer

Our SDK is now properly supportive of composer which has become the de facto dependency management tool in PHP. Just add the following configuration to your composer.json file:

{
    "require": {
        "rollbar/rollbar": "~1.0"
    }
}

Standardized namespace

We are now using PHP namespaces, a feature introduced in 5.3. At the top of your file, you can delete require_once 'rollbar.php'; and instead add the following:

use RollbarRollbar;

Standardized logging method

You can now call a single log method with the ability to set the level and include all of the same data as before, instead of different method calls for report_exception, report_message, etc. This makes it consistent with our notifier libraries for other popular languages.

use RollbarPayloadLevel;

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

Current users of the PHP notifier can quickly update to the new version because it’s backwards compatible. Just remove the old PHP notifier file, and add the new dependency in composer. While it is optional, we do recommend that you use the new logging interface, since it lays the groundwork for future improvements.

If you previously tried our PHP error tracking library, but found it difficult to use, give the new one a try since it is much easier to set up and is more reliable.


If you haven’t already, sign up for a 14-day free trial of Rollbar and let us help you take control of your PHP errors.

"Rollbar allows us to go from alerting to impact analysis and resolution in a matter of minutes. Without it we would be flying blind."

Error Monitoring

Start continuously improving your code today.

Get Started Shape