Download the PHP package sfertrack/rollbar-symfony-bundle without Composer

On this page you can find all versions of the php package sfertrack/rollbar-symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rollbar-symfony-bundle

Introduction

Rollbar is one of the best bug tracking systems that supported a lot of programming languages, including PHP.

You can find their official php library here and symfony bundle that allow easily integrate rollbar to your application. Unfortunately, they announced that the bundle will not be actively developed and will be archived in January 2025:

As of May 2024, Rollbar will not be actively updating this repository and plans to archive it in January of 2025. We encourage our community to fork this repo if you wish to continue its development. While Rollbar will no longer be engaging in active development, we remain committed to reviewing and merging pull requests related to security updates. If an actively maintained fork emerges, please reach out to our support team and we will link to it from our documentation.

So, looks like it's time to create new rollbar symfony bundle that will support actual PHP and symfony versions.

Set up instructions

  1. To set up the bundle you need to sign up rollbar account
  2. Add the bundle with composer:

  3. Create rollbar_symfony.yaml configuration file (if you use application structure recommended by symfony, then it should be placed to config/packages folder)
  4. Configure your Rollbar setup in config/packages/rollbar_symfony.yaml or in any of the environment subdirectories:

That's it! Rollbar is integrated to your application.

For complete configuration reference take a look official documentation

Additional configuration

This bundle provides you with several services and patterns that simplify developer life like:

PersonProvider service

The service automatically collects information about authenticated users if your application uses symfony/security-bundle. No extra configuration is needed.

If you use impersonation feature, the service will also collect information about the impersonator.

To collect user information, the service uses Symfony serializer. You can easily define which fields you want to report to Rollbar by configuring user entity serialization groups.

If you want to implement your own service to collect user information, simply implement PersonProviderInterface

You can define several person provider services if your application has a complex authentication flow. All services that implement PersonProviderInterface are called in turn, until one of them returns user data.

PersonProvider that comes with this bundle has a priority of -1 and is called last, in case previous services couldn't provide user data.

Exceptions thrown by person provider services don't stop the call queue. So, don't worry if your person provider service throws an exception - the original exception will still be delivered to Rollbar.

(!) Note: If a person provider service returns an array without an id key, Rollbar won't report user data at all

CheckIgnoreVoter

Sometimes we don't need to see noisy exceptions when a route is not found, a method is not allowed, access is denied, or similar issues occur. For these cases, Rollbar has a check_ignore option.

You can define your own service to ignore exceptions with custom rules. To do this, simply implement CheckIgnoreVoterInterface.

The bundle allows you to create several voters, as the logic to ignore exceptions can be quite complex. All voters that implement the interface will be called one by one until one of them votes to ignore the occurred exception. If this doesn't happen, the exception will be reported to Rollbar.

For you convenience the bundle includes an example: CheckIgnoreVoter. If you want to use it, you can simply define the class as a service in your configuration files.

ExceptionExtraDataProvider

The bundle provides an interface for exceptions that allows easy passing of additional context to reported exceptions. Typically, developers include this context in exception messages, but this approach becomes inconvenient, especially when the context contains responses from other services.

To address this issue, the bundle includes ExceptionExtraDataInterface. This interface defines only one method: getExtraData. When a thrown exception implements ExceptionExtraDataInterface, getExtraData method is called to retrieve the additional data previously passed by the developer. It's assumed that this data is passed through the constructor when the exception is created.

Scrubber

By default, Rollbar provides a scrubber that allows you to scrub specific values by key. Take a look on scrub_fields option

Sometimes, you need to scrub cookie values, such as user sessions, but still want to see other cookies in the occurrence details.

To resolve this problem, the bundle includes CookieScrubber

This scrubber is enabled by default. List of keys to be scrubbed can be configured using the scrub_cookie_fields option

You can also add your own scrubber, here are two ways to do it:

RollbarReporter

You might occasionally need to catch an exception, handle it, and log it to Rollbar, especially to track down tricky issues.

RollbarReporter can assist you with this.

IgnoreExceptionInterface

IgnoreExceptionInterface is designed to ignore exceptions. The interface is used by CheckIgnoreVoter. Therefore, if you do not want to report some of your exceptions, they just need to implement this interface.

AbstractExtraDataException

Developers sometimes encounter cases where they need to add extra data to already thrown exceptions that implement ExceptionExtraDataInterface.

To handle such cases, AbstractExtraDataException was designed. It implements the ExceptionExtraDataInterface::getExtraData method and introduces an abstract method, getExceptionExtraData, which should provide data passed to the exception's constructor.

The abstract class also has an addExtraDataItem method that adds a value to the protected extraData field. When getExtraData method is called, any extra data passed to the exception's constructor will be merged with any additional extra data items added later, and returned as a single array.

Example you can see in test: PayOrderController

UserFriendlyExceptionInterface

Sometimes, exception messages may contain technical information; displaying these messages to users is not good practice.

UserFriendlyExceptionInterface is designed to distinguish exceptions whose messages are user-friendly and can be displayed to the user. Typically, these types of exceptions do not require a fix from developers; instead, users should perform certain actions themselves.

Imagine your developed application depends on an external service. Occasionally, this service might be broken and return a 5xx error. In such a case, you can throw your own exception that implements UserFriendlyExceptionInterface. You can rely on this interface and simply display the exception message to the user.

For example:

Scrubbing environment variables

Scrubbing production application secrets is a good practice. By default, the Rollbar package dumps local environment variables, as the local_vars_dump option is enabled by default. The Symfony HTTP request object has a server field that contains environment variables. These environment variables may contain secret keys, such as a database DSN. You will likely want to keep these values hidden, especially from junior developers.

Here are two possible ways to keep environment variables hidden:


All versions of rollbar-symfony-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
symfony/http-kernel Version ^6.4|^7.0
rollbar/rollbar Version ^4.0
symfony/config Version ^6.4|^7.0
symfony/dependency-injection Version ^6.4|^7.0
symfony/serializer Version ^6.4|^7.0
symfony/yaml Version ^6.4|^7.0
symfony/monolog-bundle Version ^3.10
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sfertrack/rollbar-symfony-bundle contains the following files

Loading the files please wait ....