This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony2 Bundle for integrating with the Google DFP Ad Network.

Installs: 75

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 6

Open Issues: 2


dev-master / 1.0.x-dev 2013-09-03 14:51 UTC

This package is not auto-updated.

Last update: 2019-02-20 17:34:39 UTC


Installation Instructions

  1. Download NodrewDfpBundle
  2. Configure the Autoloader
  3. Enable the Bundle
  4. Add your Google DFP Publisher Id

Step 1: Download NodrewDfpBundle

Ultimately, the NodrewDfpBundle files should be downloaded to the vendor/bundles/Nodrew/Bundle/DfpBundle directory.

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

Using the vendors script

Add the following lines in your deps file:


Now, run the vendors script to download the bundle:

$ php bin/vendors install

Using submodules

If you prefer instead to use git submodules, then run the following:

$ git submodule add http://github.com/nodrew/NodrewDfpBundle.git vendor/bundles/Nodrew/Bundle/DfpBundle
$ git submodule update --init

Step 2: Configure the Autoloader

// app/autoload.php

$loader = new UniversalClassLoader();
    // ...
    'Nodrew'   => __DIR__.'/../vendor/bundles',

Step 3: Enable the bundle

Finally, enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Nodrew\Bundle\DfpBundle\NodrewDfpBundle(),

Step 4: Add your Google DFP Publisher Id

# app/config/config.yml
    publisher_id:   [publisher_id]

Step 5: Add Control Code Placeholder to layout

This placeholder comment needs to be added to the head of your layout. It is automatically replaced with the proper Google DFP code, when ads are used on the given page.

// app/views/base.html.twig
    <!-- NodrewDfpBundle Control Code -->

Using Ad Units

In page unit.

To use a standard in page ad unit, add the following to your template:

{{ dfp_ad_unit('some/campaign', [300, 250]) }}

The appropriate control codes will be added to the header, if everything was done correctly during setup.

Out of page unit.

If you're looking to do a DFP out of page unit, such as an interstitial, or a skin, then use this code. It is much similar, just without the size attached to it.

{{ dfp_oop_ad_unit('some/campaign') }}

The appropriate control codes will be added to the header, if everything was done correctly during setup.