Find file
Fetching contributors…
Cannot retrieve contributors at this time
356 lines (244 sloc) 8.13 KB

Symfony2 Admin Generator: The Real Missing Admin Generator for Symfony2! project status# build status

⚠️ This branch work only with the symfony 2.1 for 2.0 use the 2.0 branch ⚠️

This package is a Symfony2 Admin Generator based on YAML configuration and Twig templating. It's inspired by fzaninotto/Doctrine2ActiveRecord.

It actually supports:

  • Doctrine ORM
  • Doctine ODM
  • Propel

With almost the same features:

  • A YAML to configure create/edit/delete/list actions
  • Manage relations one to one, one to many, many to one and many to many
  • Easy edit of forms by changing properties of fields in YAML.
  • Configure fieldsets
  • Configure more that one field per line
  • Change the database column you want to sortOn or filterOn for a field in list
  • A complete admin design
  • Translated into EN, FR, RU, PT, ES, SL, DE , PL, UA, IT (you can easily contribute to add your own)
  • Filters by form & by scopes combinable
  • Credentials for actions, columns, and form fields
  • ...

This bundle in pictures

Preview of list

Preview of edit

Want another skin?

Just install ActiveAdminTheme

Preview of ActiveAdminTheme

Want to run a test?

The fastest way to try it is to setup the AdmingeneratorIpsum project: This is a complete Symfony2 application with this bundle well configured.


Install this bundle

Using composer

"require": {
    "cedriclombardot/admingenerator-generator-bundle": "dev-master"

php composer.phar update

Or cloning

git clone git:// vendor/bundles/Admingenerator/GeneratorBundle

Or using deps file


Register it in the autoload.php file:

// app/autoload.php

    'Admingenerator'    => array(__DIR__.'/../src', __DIR__.'/../vendor/bundles'),

Add it to the AppKernel class:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...

        // Admin Generator
        new Admingenerator\GeneratorBundle\AdmingeneratorGeneratorBundle(),
        new Admingenerator\OldThemeBundle\AdmingeneratorOldThemeBundle(),

    // ...

In config.yml

    templates_dirs: [ %kernel.root_dir%/../vendor/cedriclombardot/admingenerator-oldtheme-bundle/Admingenerator/OldThemeBundle/Resources/templates ]

Install SensioGeneratorBundle

git submodule add git:// vendor/bundles/Sensio/Bundle/GeneratorBundle

Register it in the autoload.php file:

// app/autoload.php

    'Sensio\Bundle'     => __DIR__.'/../vendor/bundles',

Add it to the AppKernel class:

$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(),

Install KnpMenuBundle

git submodule add vendor/bundles/Knp/Bundle/MenuBundle
git submodule add vendor/KnpMenu

or using deps file



Register it in the autoload.php file:

// app/autoload.php

    'Knp'       => __DIR__.'/../vendor/bundles',
    'Knp\Menu'  => __DIR__.'/../vendor/KnpMenu/src'

Add it to the AppKernel class:

$bundles[] = new Knp\Bundle\MenuBundle\KnpMenuBundle();

Don't forget to configure it to use twig in config.yml:

    twig: true

Now two ways to continue the setup:

Manually, follow the end of readme, or automatically,

php app/console admin:setup

Install TwigGenerator

git submodule add vendor/twig-generator

Register it in the autoload.php file:

// app/autoload.php

    'TwigGenerator'         => __DIR__.'/../vendor/twig-generator/src',

Install Pagerfanta

git submodule add vendor/pagerfanta
git submodule add vendor/bundles/WhiteOctober/PagerfantaBundle

Register it in the autoload.php file:

// app/autoload.php

    'WhiteOctober\PagerfantaBundle' => __DIR__.'/../vendor/bundles',
    'Pagerfanta'                    => __DIR__.'/../vendor/pagerfanta/src',

Add it to the AppKernel class:

$bundles[] = new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),

Configure JMS

In config.yml

     expressions: true

Setup the Model Manager you want

At this step, you'll have to install the Model Manager you want (Doctrine ORM, Doctrine ODM and/or Propel). E.g. with Doctrine, you'll have to setup the Doctrine2FixtureBundle bundle.

Install Doctrine2FixtureBundle & Create the database

php app/console doctrine:database:create
php app/console doctrine:schema:create
php app/console doctrine:fixtures:load

Install Assetic (Optionnal see without assetic part)

git submodule add git:// vendor/bundles/Symfony/Bundle/AsseticBundle
git submodule add git:// vendor/assetic

Register it in the autoload.php file:

// app/autoload.php

    'Assetic'           => __DIR__.'/../vendor/assetic/src',

Add it to the AppKernel class:

$bundles[] = new Symfony\Bundle\AsseticBundle\AsseticBundle(),

Configure the routing in app/config/routing.yml:

    resource: .
    type: assetic

To run assets you also need to install sass & compass:

sudo gem install compass #
sudo gem install sass

Configure Assetic:

        cssrewrite: ~
            bin: /var/lib/gems/1.8/gems/sass-3.1.7/bin/sass
            compass: /var/lib/gems/1.8/gems/compass-0.11.5/bin/compass

Without Assetic

Configure your config.yml to use the assetic less template

    base_admin_template: AdmingeneratorOldThemeBundle::base_admin_assetic_less.html.twig
    login_template: AdmingeneratorOldThemeBundle::base_login_assetic_less.html.twig

With or without assetic

Publish assets:

php app/console assets:install web/

Last step for prod:

php app/console -env prod cache:warmup

Running tests

Bundle use phpunit framework for testing. To running test suite please first install needed deps.

Using composer:

curl -s | php
php composer.phar install --dev

then you can run tests by phpunit command

Need support?

Sensio Connect

Note: The admin theme is from