Skip to main content

Symfony

The official Streply library for the Symfony framework.

Install

The first step is to download the streply/streply-symfony package using the composer.

composer require streply/streply-symfony

Enable the bundle

Add the bundle to the list of registered bundles in config/bundles.php.

PHP
return [
...
Streply\StreplyBundle\StreplyBundle::class => ['all' => true]
];

Configuration

Add default configuration in config/packages/streply.yaml.

streply:
dsn: '%env(STREPLY_DSN)%'

Then add your DSN to .env file.

###> streply/streply-bundle ###
STREPLY_DSN="https://clientPublicKey@api.streply.com/projectId"
###< streply/streply-bundle ###
info

You can find the DSN code of the project in the Projects tab of your Streply account.

Optional configuration

If you want to set some additional configuration, you need to create an event listener and use the Streply\Configuration::filterBeforeSend(); method in the onKernelException method in ExceptionListener.

info

Read more about events in symfony here and about Streply configuration here.

src/EventListener/ExceptionListener.php
<?php
namespace App\EventListener;

use Symfony\Component\HttpKernel\Event\ExceptionEvent;

class ExceptionListener
{
public function onKernelException(ExceptionEvent $event)
{
\Streply\Configuration::filterBeforeSend(function(\Streply\Entity\Event $event) {
if($event->getMessage() === 'someMessage') {
return false;
}

return true;
});
}
}