PHP code example of theofidry / sfcontext-bundle

1. Go to this page and download the library: Download theofidry/sfcontext-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/ */

    

theofidry / sfcontext-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Fidry\SfContextBundle\SfContextBundle(),
    );

    return $bundles;
}

class DummyService
{
    public function foo()
    {
        // Do something

        SfContext::get('logger')->debug('it worked');

        // Do something else
    }
}