PHP code example of evolution7 / bugsnag-bundle
1. Go to this page and download the library: Download evolution7/bugsnag-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/ */
evolution7 / bugsnag-bundle example snippets
$bundles = array(
//Other Bundles
new Evolution7\BugsnagBundle\BugsnagBundle(),
# src/AppBundle/BugsnagUser.php
namespace AppBundle;
use Evolution7\BugsnagBundle\UserInterface as BugsnagUserInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\User\UserInterface as SymfonyUserInterface;
class BugsnagUser implements BugsnagUserInterface
{
/**
* @var TokenStorageInterface
*/
private $token;
/**
* @param TokenStorageInterface $token
*/
public function __construct(TokenStorageInterface $token)
{
$this->token = $token->getToken();
}
/**
* @inheritdoc
*/
public function getUserAsArray()
{
if (
is_null($this->token)
|| !$this->token->isAuthenticated()
|| !$this->token->getUser() instanceof SymfonyUserInterface
) {
return [];
}
$user = $this->token->getUser();
return [
'id' => $user->getId(),
'name' => $user->getUsername(),
'email' => $user->getEmail()
];
}
}