2017 © Pedro Peláez
 

symfony-bundle exceptional-bundle

Symfony2 Bundle for working with the Exceptional Service

image

nodrew/exceptional-bundle

Symfony2 Bundle for working with the Exceptional Service

  • Tuesday, September 4, 2012
  • by nodrew
  • Repository
  • 2 Watchers
  • 3 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Exceptional Bundle for Symfony2 Travis-CI Build Status

For use with the Exceptional service at: http://www.getexceptional.com, (*1)

Installation Instructions

  1. Download NodrewExceptionalBundle
  2. Configure the Autoloader
  3. Enable the Bundle
  4. Add your Exceptional API key

Step 1: Download NodrewExceptionalBundle

Ultimately, the NodrewExceptionalBundle files should be downloaded to the vendor/bundles/Nodrew/Bundle/ExceptionalBundle directory., (*2)

This can be done in several ways, depending on your preference. The first method is the standard Symfony2 method., (*3)

Using the vendors script, (*4)

Add the following lines in your deps file:, (*5)

[NodrewExceptionalBundle]
    git=http://github.com/nodrew/NodrewExceptionalBundle.git
    target=/bundles/Nodrew/Bundle/ExceptionalBundle

Now, run the vendors script to download the bundle:, (*6)

``` bash $ php bin/vendors install, (*7)


**Using submodules** If you prefer instead to use git submodules, then run the following: ``` bash $ git submodule add http://github.com/nodrew/NodrewExceptionalBundle.git vendor/bundles/Nodrew/Bundle/ExceptionalBundle $ git submodule update --init

Step 2: Configure the Autoloader

``` php registerNamespaces(array( // ... 'Nodrew' => __DIR__.'/../vendor/bundles', )); ``` ### Step 3: Enable the bundle Finally, enable the bundle in the kernel: ``` php securityContext = $securityContext; } /** * {@inheritdoc} */ public function getContext() { $context = array(); $token = $this->securityContext->getToken(); if ($token && $token->isAuthenticated()) { $context['userId'] = $token->getUser()->getId(); $context['username'] = $token->getUser()->getUsername(); } return $context; } } ``` #### Step 2: Create your service id ``` xml // src/Acme/DemoBundle/Resources/config/services.xml , (*8)

, (*9)

<parameters>
    <parameter key="acme.exceptional.context.handler.class">Acme\DemoBundle\Handler\ExceptionalContextHandler</parameter>
</parameters>

<services>
    <service id="acme.exceptional.context.handler" class="%acme.exceptional.context.handler.class%">
        <argument type="service" id="security.context" />
    </service>
</services>

, (*10)

#### Step 3: Add your context id to the config

``` yaml
// app/config/config.yml
nodrew_exceptional:
    context_id: acme.exceptional.context.handler

And that's it. Now you should see the username and userId added to the params in exceptional, if a user is logged in. If they are not, then it will be blank. You can of course add your own parameters to that array. Just be sure that it returns an array. If it returns anything else, then it will be skipped., (*11)

TODO

  • Add 404 Handling, so they are parsed and added to the 404 list inside of Exceptional's backend.

The Versions

04/09 2012

dev-master

9999999-dev https://github.com/nodrew/NodrewExceptionalBundle

Symfony2 Bundle for working with the Exceptional Service

  Sources   Download

The Requires

 

api exceptional