phpOpenEMM now on github

We recently moved the source code for the PHP – wrapper for the email marketing software OpenEMM to github. It is also available via packagist for easier installation. Feel free to follow, fork and send pull requests!


Symfony2: InactiveScopeException and request

Error message: You cannot create a service (“request”) of an inactive scope (“request”).

You cannot create a service ("request") of an inactive scope ("request").

This message is written, when you’re invoking a command on the command line, e.g.

php app/console assetic:dump

Reason: you are using a request object, but this is not available on the command line / cli

The error was in my case that I used an object in my service configuration that references the request object (MobileDetectBundle).

Solution: remove reference for command line

Step 1 was to use a setter for the reference

Step 2 was to create a special compiler pass in the bundle configuration

Source code (based on – thanks suncat2000!)


namespace Acm\DemoBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;

 * CLI listener
class CLIListenerPass implements CompilerPassInterface
     * If CLI, when remove setMobileDetector method from definition mobile_detect.twig.extension
     * @param ContainerBuilder $container 
    public function process(ContainerBuilder $container)
        if (php_sapi_name() == "cli") {
            $definition = $container->getDefinition('acme_demo.extension.my_service');

sample code for Google Client API published


The sample code for the Google Client API pages has been updated. It now uses the names of the new Google Client PHP API release and also switched from object – reference to arrays. Finally the source code is available … Continue reading