All Projects → getsentry → Sentry Symfony

getsentry / Sentry Symfony

Licence: apache-2.0
The official Symfony SDK for Sentry (sentry.io)

Projects that are alternatives of or similar to Sentry Symfony

Doctrinebundle
Symfony Bundle for Doctrine ORM and DBAL
Stars: ✭ 4,225 (+720.39%)
Mutual labels:  bundle, hacktoberfest, symfony, symfony-bundle
Symfony
The Symfony PHP framework
Stars: ✭ 26,220 (+4991.26%)
Mutual labels:  bundle, hacktoberfest, symfony, symfony-bundle
Pugxautocompleterbundle
Add an autocomplete field to your Symfony forms
Stars: ✭ 83 (-83.88%)
Mutual labels:  bundle, hacktoberfest, symfony, symfony-bundle
Sonatadoctrineormadminbundle
Integrate Doctrine ORM into the SonataAdminBundle
Stars: ✭ 400 (-22.33%)
Mutual labels:  bundle, symfony, symfony-bundle
Exporter
Lightweight Exporter library
Stars: ✭ 384 (-25.44%)
Mutual labels:  bundle, symfony, symfony-bundle
Lexiktranslationbundle
This Symfony2 bundle allow to import translation files content into the database and provide a GUI to edit translations.
Stars: ✭ 347 (-32.62%)
Mutual labels:  bundle, symfony, symfony-bundle
Liipthemebundle
Provides theming support for Symfony bundles
Stars: ✭ 292 (-43.3%)
Mutual labels:  bundle, symfony, symfony-bundle
Doctrineenumbundle
📦 Provides support of ENUM type for Doctrine in Symfony applications.
Stars: ✭ 410 (-20.39%)
Mutual labels:  bundle, symfony, symfony-bundle
Lexikformfilterbundle
This Symfony bundle aim to provide classes to build some form filters and then build a doctrine query from this form filter.
Stars: ✭ 360 (-30.1%)
Mutual labels:  bundle, symfony, symfony-bundle
Sonatamediabundle
Symfony SonataMediaBundle
Stars: ✭ 415 (-19.42%)
Mutual labels:  bundle, symfony, symfony-bundle
Phone Number Bundle
Integrates libphonenumber into your Symfony2-Symfony4 application
Stars: ✭ 446 (-13.4%)
Mutual labels:  bundle, symfony, symfony-bundle
Doctrinemigrationsbundle
Symfony integration for the doctrine/migrations library
Stars: ✭ 3,782 (+634.37%)
Mutual labels:  bundle, symfony, symfony-bundle
Easyadminbundle
EasyAdmin is a fast, beautiful and modern admin generator for Symfony applications.
Stars: ✭ 3,391 (+558.45%)
Mutual labels:  bundle, symfony, symfony-bundle
Sonatauserbundle
Symfony SonataUserBundle
Stars: ✭ 301 (-41.55%)
Mutual labels:  bundle, symfony, symfony-bundle
Jwtrefreshtokenbundle
Implements a Refresh Token system over Json Web Tokens in Symfony
Stars: ✭ 425 (-17.48%)
Mutual labels:  bundle, symfony, symfony-bundle
Liipmonitorbundle
Integrates the LiipMonitor library into Symfony
Stars: ✭ 445 (-13.59%)
Mutual labels:  bundle, symfony, symfony-bundle
Assetic Bundle
[DEPRECATED] This was the recommended way to manage web assets in Symfony 2 applications. Newer Symfony applications should use Webpack Encore.
Stars: ✭ 370 (-28.16%)
Mutual labels:  bundle, symfony, symfony-bundle
Foscommentbundle
Threaded comments for Symfony
Stars: ✭ 451 (-12.43%)
Mutual labels:  bundle, symfony, symfony-bundle
Sensioframeworkextrabundle
An extension to Symfony FrameworkBundle that adds annotation configuration for Controller classes
Stars: ✭ 3,203 (+521.94%)
Mutual labels:  bundle, symfony, symfony-bundle
Translationformbundle
Ease translations with some dedicated Symfony form types
Stars: ✭ 289 (-43.88%)
Mutual labels:  bundle, symfony, symfony-bundle

sentry-symfony

Symfony integration for Sentry.

Stable release Total Downloads Monthly Downloads License

CI Coverage Status Discord

Benefits

Use sentry-symfony for:

  • A fast Sentry setup
  • Easy configuration in your Symfony app
  • Automatic wiring in your app. Each event has the following things added automatically to it:
    • user
    • Symfony environment
    • app path
    • excluded paths (cache and vendor)

Installation

To install the SDK you will need to be using Composer in your project. To install it please see the docs.

composer require sentry/sentry-symfony

If you're using the Symfony Flex Composer plugin, it could show a message similar to this:

The recipe for this package comes from the "contrib" repository, which is open to community contributions.
Review the recipe at https://github.com/symfony/recipes-contrib/tree/master/sentry/sentry-symfony/3.0

Do you want to execute this recipe?

Just type y, press return, and the procedure will continue.

Warning: due to a bug in all versions lower than 6.0 of the SensioFrameworkExtra bundle, if you have it installed you will likely get an error during the execution of the commands above in regards to the missing Nyholm\Psr7\Factory\Psr17Factory class. To workaround the issue, if you are not using the PSR-7 bridge, please change the configuration of that bundle as follows:

sensio_framework_extra:
   psr_message:
      enabled: false

For more details about the issue see https://github.com/sensiolabs/SensioFrameworkExtraBundle/pull/710.

Step 2: Enable the Bundle

If you installed the package using the Flex recipe, the bundle will be automatically enabled. Otherwise, enable it by adding it to the list of registered bundles in the Kernel.php file of your project:

class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
    public function registerBundles(): array
    {
        return [
            // ...
            new \Sentry\SentryBundle\SentryBundle(),
        ];
    }

    // ...
}

Note that, unlike before in version 3, the bundle will be enabled in all environments; event reporting, instead, is enabled only when providing a DSN (see the next step).

Configuration of the SDK

Add your Sentry DSN value of your project, if you have Symfony 3.4 add it to app/config/config_prod.yml for Symfony 4 or newer add the value to config/packages/sentry.yaml. Keep in mind that leaving the dsn value empty (or undeclared) in other environments will effectively disable Sentry reporting.

sentry:
    dsn: "https://public:[email protected]/1"
    messenger: 
        enabled: true # flushes Sentry messages at the end of each message handling
        capture_soft_fails: true # captures exceptions marked for retry too
    options:
        environment: '%kernel.environment%'
        release: '%env(VERSION)%' #your app version

The parameter options allows to fine-tune exceptions. To discover more options, please refer to the Unified APIs options and the PHP specific ones.

Optional: use custom HTTP factory/transport

Since SDK 2.0 uses HTTPlug to remain transport-agnostic, you need to have installed two packages that provides php-http/async-client-implementation and http-message-implementation.

This bundle depends on sentry/sdk, which is a metapackage that already solves this need, requiring our suggested HTTP packages: the Curl client and Guzzle's message factories.

If instead you want to use a different HTTP client or message factory, you can override the sentry/sdk package adding the following to your composer.json after the require section:

    "replace": {
        "sentry/sdk": "*"
    }

This will prevent the installation of sentry/sdk package and will allow you to install through Composer the HTTP client or message factory of your choice.

For example for using Guzzle's components:

composer require php-http/guzzle6-adapter guzzlehttp/psr7

A possible alternate solution is using pugx/sentry-sdk, a metapackage that replaces sentry/sdk and uses symfony/http-client instead of guzzlehttp/guzzle:

composer require pugx/sentry-sdk

Maintained versions

  • 4.x is actively maintained and developed on the master branch, and uses Sentry SDK 3.0;
  • 3.x is supported only for fixes and uses Sentry SDK 2.0;
  • 2.x is no longer maintained; from this version onwards it requires Symfony 3+ and PHP 7.1+;
  • 1.x is no longer maintained; you can use it for Symfony < 2.8 and PHP 5.6/7.0;
  • 0.8.x is no longer maintained.

Upgrading to 4.0

The 4.0 version of the bundle uses the newest version (3.x) of the underlying Sentry SDK. If you need to migrate from previous versions, please check the UPGRADE-4.0.md document.

Custom serializers

The option class_serializers can be used to send customized objects serialization.

sentry:
    options:
        class_serializers:
            YourValueObject: 'ValueObjectSerializer'

Several serializers can be added and the serializable check is done using instanceof. The serializer must implements the __invoke method returning an array with the information to send to sentry (class name is always sent).

Serializer example:

final class ValueObjectSerializer
{
    public function __invoke(YourValueObject $vo): array
    {
        return [
            'value' => $vo->value()
        ];
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].