PHP code example of onlime / exception-report-bundle
1. Go to this page and download the library: Download onlime/exception-report-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
onlime / exception-report-bundle example snippets
# app/AppKernel.php
// ...
public function registerBundles()
{
$bundles = array(
// ...
new Onlime\ExceptionReportBundle\OnlimeExceptionReportBundle(),
);
}
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* @Route("/demo")
*/
class DemoController extends Controller
{
/**
* Simply throws an Exception to test exception reporting.
*
* @Route("/exception", name="demo_exception")
*/
public function exceptionAction()
{
throw new \Exception('Something really bad happened!');
}
}
use Onlime\ExceptionReportBundle\Event\ExceptionEvent;
use Onlime\ExceptionReportBundle\Event\ExceptionEvents;
// ...
try {
// do some dangerous stuff here...
} catch (\Exception $e) {
$this->get('event_dispatcher')->dispatch(
ExceptionEvents::REPORT,
new ExceptionEvent($e)
);
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.