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
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 ###
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
.
Read more about events in symfony here and about Streply configuration here.
Example:
// 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; }); } }
See more
-
Configuration
See what configuration options you have. -
Event Dispatcher
See how to set ExceptionListener in Symfony project.
Package
streply/streply-symfony
Repository
https://github.com/streply/streply-symfony