Commits

eugenio pombi  committed 89df5c2

removes ACME vendor
creates PUGXBookBundle
makes an Hello World with test

  • Participants
  • Parent commits 42ed412
  • Tags cap2

Comments (0)

Files changed (40)

File app/AppKernel.php

             new Symfony\Bundle\AsseticBundle\AsseticBundle(),
             new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
             new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+            new PUGX\BookBundle\PUGXBookBundle(),
         );
 
         if (in_array($this->getEnvironment(), array('dev', 'test'))) {
-            $bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
             $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
             $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
             $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();

File app/config/routing.yml

+pugx_book:
+    resource: "@PUGXBookBundle/Resources/config/routing.yml"
+    prefix:   /

File app/config/routing_dev.yml

 
 _main:
     resource: routing.yml
-
-# AcmeDemoBundle routes (to be removed)
-_acme_demo:
-    resource: "@AcmeDemoBundle/Resources/config/routing.yml"

File src/Acme/DemoBundle/AcmeDemoBundle.php

-<?php
-
-namespace Acme\DemoBundle;
-
-use Symfony\Component\HttpKernel\Bundle\Bundle;
-
-class AcmeDemoBundle extends Bundle
-{
-}

File src/Acme/DemoBundle/Controller/DemoController.php

-<?php
-
-namespace Acme\DemoBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Symfony\Component\HttpFoundation\RedirectResponse;
-use Acme\DemoBundle\Form\ContactType;
-
-// these import the "@Route" and "@Template" annotations
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
-
-class DemoController extends Controller
-{
-    /**
-     * @Route("/", name="_demo")
-     * @Template()
-     */
-    public function indexAction()
-    {
-        return array();
-    }
-
-    /**
-     * @Route("/hello/{name}", name="_demo_hello")
-     * @Template()
-     */
-    public function helloAction($name)
-    {
-        return array('name' => $name);
-    }
-
-    /**
-     * @Route("/contact", name="_demo_contact")
-     * @Template()
-     */
-    public function contactAction()
-    {
-        $form = $this->get('form.factory')->create(new ContactType());
-
-        $request = $this->get('request');
-        if ($request->isMethod('POST')) {
-            $form->submit($request);
-            if ($form->isValid()) {
-                $mailer = $this->get('mailer');
-                // .. setup a message and send it
-                // http://symfony.com/doc/current/cookbook/email.html
-
-                $this->get('session')->getFlashBag()->set('notice', 'Message sent!');
-
-                return new RedirectResponse($this->generateUrl('_demo'));
-            }
-        }
-
-        return array('form' => $form->createView());
-    }
-}

File src/Acme/DemoBundle/Controller/SecuredController.php

-<?php
-
-namespace Acme\DemoBundle\Controller;
-
-use Symfony\Component\HttpFoundation\Request;
-use Symfony\Component\Security\Core\SecurityContext;
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
-use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
-
-/**
- * @Route("/demo/secured")
- */
-class SecuredController extends Controller
-{
-    /**
-     * @Route("/login", name="_demo_login")
-     * @Template()
-     */
-    public function loginAction(Request $request)
-    {
-        if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
-            $error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
-        } else {
-            $error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
-        }
-
-        return array(
-            'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
-            'error'         => $error,
-        );
-    }
-
-    /**
-     * @Route("/login_check", name="_security_check")
-     */
-    public function securityCheckAction()
-    {
-        // The security layer will intercept this request
-    }
-
-    /**
-     * @Route("/logout", name="_demo_logout")
-     */
-    public function logoutAction()
-    {
-        // The security layer will intercept this request
-    }
-
-    /**
-     * @Route("/hello", defaults={"name"="World"}),
-     * @Route("/hello/{name}", name="_demo_secured_hello")
-     * @Template()
-     */
-    public function helloAction($name)
-    {
-        return array('name' => $name);
-    }
-
-    /**
-     * @Route("/hello/admin/{name}", name="_demo_secured_hello_admin")
-     * @Template()
-     */
-    public function helloadminAction($name)
-    {
-        return array('name' => $name);
-    }
-}

File src/Acme/DemoBundle/Controller/WelcomeController.php

-<?php
-
-namespace Acme\DemoBundle\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
-
-class WelcomeController extends Controller
-{
-    public function indexAction()
-    {
-        /*
-         * The action's view can be rendered using render() method
-         * or @Template annotation as demonstrated in DemoController.
-         *
-         */
-        return $this->render('AcmeDemoBundle:Welcome:index.html.twig');
-    }
-}

File src/Acme/DemoBundle/DependencyInjection/AcmeDemoExtension.php

-<?php
-
-namespace Acme\DemoBundle\DependencyInjection;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
-use Symfony\Component\HttpKernel\DependencyInjection\Extension;
-use Symfony\Component\Config\FileLocator;
-
-class AcmeDemoExtension extends Extension
-{
-    public function load(array $configs, ContainerBuilder $container)
-    {
-        $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
-        $loader->load('services.xml');
-    }
-
-    public function getAlias()
-    {
-        return 'acme_demo';
-    }
-}

File src/Acme/DemoBundle/EventListener/ControllerListener.php

-<?php
-
-namespace Acme\DemoBundle\EventListener;
-
-use Symfony\Component\HttpKernel\HttpKernelInterface;
-use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
-use Acme\DemoBundle\Twig\Extension\DemoExtension;
-
-class ControllerListener
-{
-    protected $extension;
-
-    public function __construct(DemoExtension $extension)
-    {
-        $this->extension = $extension;
-    }
-
-    public function onKernelController(FilterControllerEvent $event)
-    {
-        if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
-            $this->extension->setController($event->getController());
-        }
-    }
-}

File src/Acme/DemoBundle/Form/ContactType.php

-<?php
-
-namespace Acme\DemoBundle\Form;
-
-use Symfony\Component\Form\AbstractType;
-use Symfony\Component\Form\FormBuilderInterface;
-
-class ContactType extends AbstractType
-{
-    public function buildForm(FormBuilderInterface $builder, array $options)
-    {
-        $builder->add('email', 'email');
-        $builder->add('message', 'textarea');
-    }
-
-    public function getName()
-    {
-        return 'contact';
-    }
-}

File src/Acme/DemoBundle/Resources/config/routing.yml

-_welcome:
-    pattern:  /
-    defaults: { _controller: AcmeDemoBundle:Welcome:index }
-
-_demo_secured:
-    resource: "@AcmeDemoBundle/Controller/SecuredController.php"
-    type:     annotation
-
-_demo:
-    resource: "@AcmeDemoBundle/Controller/DemoController.php"
-    type:     annotation
-    prefix:   /demo

File src/Acme/DemoBundle/Resources/config/services.xml

-<?xml version="1.0" ?>
-
-<container xmlns="http://symfony.com/schema/dic/services"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
-
-    <services>
-        <service id="twig.extension.acme.demo" class="Acme\DemoBundle\Twig\Extension\DemoExtension" public="false">
-            <tag name="twig.extension" />
-            <argument type="service" id="twig.loader" />
-        </service>
-
-        <service id="acme.demo.listener" class="Acme\DemoBundle\EventListener\ControllerListener">
-            <tag name="kernel.event_listener" event="kernel.controller" method="onKernelController" />
-            <argument type="service" id="twig.extension.acme.demo" />
-        </service>
-    </services>
-</container>

File src/Acme/DemoBundle/Resources/public/css/demo.css

-body {
-    font-size: 14px;
-    font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
-}
-h1.title {
-    font-size: 45px;
-    padding-bottom: 30px;
-}
-.sf-reset h2 {
-    font-weight:   bold;
-    color:         #FFFFFF;
-    /* Font is duplicated of body (sans-serif) */
-    font-family:      "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
-
-    margin-bottom:    10px;
-    background-color: #aacd4e;
-    padding:          2px 4px;
-    display:          inline-block;
-    text-transform:   uppercase;
-
-}
-p {
-    line-height:    20px;
-    padding-bottom: 20px;
-}
-ul#demo-list a {
-    background: url(../images/blue-arrow.png) no-repeat right 6px;
-    padding-right: 10px;
-    margin-right:  30px;
-}
-#symfony-header {
-    position: relative;
-    padding: 30px 30px 20px 30px;
-}
-.sf-reset .symfony-blocks-welcome {
-    overflow: hidden;
-}
-.sf-reset .symfony-blocks-welcome > div {
-    background-color: whitesmoke;
-    float:            left;
-    width:            240px;
-    margin-right:     14px;
-    text-align:       center;
-    padding:          26px 20px;
-}
-.sf-reset .symfony-blocks-welcome > div.block-demo {
-    margin-right: 0;
-}
-.sf-reset .symfony-blocks-welcome .illustration {
-    padding-bottom: 20px;
-}
-.sf-reset .symfony-blocks-help {
-    overflow: hidden;
-}
-.sf-reset .symfony-blocks-help {
-    margin-top: 30px;
-    padding:    18px;
-    border:     1px solid #E6E6E6;
-}
-.sf-reset .symfony-blocks-help > div {
-    width:        254px;
-    float:        left;
-}
-.flash-message {
-    padding: 10px;
-    margin: 5px;
-    margin-top: 15px;
-    background-color: #ffe;
-}
-.sf-reset .error {
-    color: red;
-}
-#login label, #contact_form label {
-    display: block;
-    float: left;
-    width: 90px;
-}
-.sf-reset ul#menu {
-    float: right;
-    margin-bottom: 20px;
-    padding-left: 0;
-}
-.sf-reset #menu li {
-    padding-left: 0;
-    margin-right: 10px;
-    display: inline;
-}
-.sf-reset a,
-.sf-reset li a {
-    color: #08C;
-    text-decoration: none;
-}
-.sf-reset a:hover,
-.sf-reset li a:hover {
-    color: #08C;
-    text-decoration: underline;
-}
-.sf-reset .symfony-content pre {
-    white-space: pre;
-    font-family: monospace;
-}

File src/Acme/DemoBundle/Resources/public/images/blue-arrow.png

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/field-background.gif

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/logo.gif

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/search.png

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/welcome-configure.gif

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/welcome-demo.gif

Removed
Old image

File src/Acme/DemoBundle/Resources/public/images/welcome-quick-tour.gif

Removed
Old image

File src/Acme/DemoBundle/Resources/views/Demo/contact.html.twig

-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Symfony - Contact form" %}
-
-{% block content %}
-    <form action="{{ path('_demo_contact') }}" method="POST" id="contact_form">
-        {{ form_errors(form) }}
-
-        {{ form_row(form.email) }}
-        {{ form_row(form.message) }}
-
-        {{ form_rest(form) }}
-        <input type="submit" value="Send" class="symfony-button-grey" />
-    </form>
-{% endblock %}

File src/Acme/DemoBundle/Resources/views/Demo/hello.html.twig

-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
-    <h1>Hello {{ name }}!</h1>
-{% endblock %}
-
-{% set code = code(_self) %}

File src/Acme/DemoBundle/Resources/views/Demo/index.html.twig

-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block title "Symfony - Demos" %}
-
-{% block content_header '' %}
-
-{% block content %}
-    <h1 class="title">Available demos</h1>
-    <ul id="demo-list">
-        <li><a href="{{ path('_demo_hello', {'name': 'World'}) }}">Hello World</a></li>
-        <li><a href="{{ path('_demo_secured_hello', {'name': 'World'}) }}">Access the secured area</a> <a href="{{ path('_demo_login') }}">Go to the login page</a></li>
-        {# <li><a href="{{ path('_demo_contact') }}">Send a Message</a></li> #}
-    </ul>
-{% endblock %}

File src/Acme/DemoBundle/Resources/views/Secured/hello.html.twig

-{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
-    <h1 class="title">Hello {{ name }}!</h1>
-
-    <a href="{{ path('_demo_secured_hello_admin', { 'name': name }) }}">Hello resource secured for <strong>admin</strong> only.</a>
-{% endblock %}
-
-{% set code = code(_self) %}

File src/Acme/DemoBundle/Resources/views/Secured/helloadmin.html.twig

-{% extends "AcmeDemoBundle:Secured:layout.html.twig" %}
-
-{% block title "Hello " ~ name %}
-
-{% block content %}
-    <h1 class="title">Hello {{ name }} secured for Admins only!</h1>
-{% endblock %}
-
-{% set code = code(_self) %}

File src/Acme/DemoBundle/Resources/views/Secured/layout.html.twig

-{% extends "AcmeDemoBundle::layout.html.twig" %}
-
-{% block content_header_more %}
-    {{ parent() }}
-    <li>logged in as <strong>{{ app.user ? app.user.username : 'Anonymous' }}</strong> - <a href="{{ path('_demo_logout') }}">Logout</a></li>
-{% endblock %}

File src/Acme/DemoBundle/Resources/views/Secured/login.html.twig

-{% extends 'AcmeDemoBundle::layout.html.twig' %}
-
-{% block content %}
-    <h1 class="title">Login</h1>
-
-    <p>
-        Choose between two default users: <em>user/userpass</em> <small>(ROLE_USER)</small> or <em>admin/adminpass</em> <small>(ROLE_ADMIN)</small>
-    </p>
-
-    {% if error %}
-        <div class="error">{{ error.message }}</div>
-    {% endif %}
-
-    <form action="{{ path("_security_check") }}" method="post" id="login">
-        <div>
-            <label for="username">Username</label>
-            <input type="text" id="username" name="_username" value="{{ last_username }}" />
-        </div>
-
-        <div>
-            <label for="password">Password</label>
-            <input type="password" id="password" name="_password" />
-        </div>
-
-        <button type="submit" class="sf-button">
-            <span class="border-l">
-                <span class="border-r">
-                    <span class="btn-bg">Login</span>
-                </span>
-            </span>
-        </button>
-    </form>
-{% endblock %}
-
-{% set code = code(_self) %}

File src/Acme/DemoBundle/Resources/views/Welcome/index.html.twig

-{% extends 'AcmeDemoBundle::layout.html.twig' %}
-
-{% block title %}Symfony - Welcome{% endblock %}
-
-{% block content_header '' %}
-
-{% block content %}
-    {% set version = constant('Symfony\\Component\\HttpKernel\\Kernel::MAJOR_VERSION') ~ '.' ~ constant('Symfony\\Component\\HttpKernel\\Kernel::MINOR_VERSION')%}
-
-    <h1 class="title">Welcome!</h1>
-
-    <p>Congratulations! You have successfully installed a new Symfony application.</p>
-
-    <div class="symfony-blocks-welcome">
-        <div class="block-quick-tour">
-            <div class="illustration">
-                <img src="{{ asset('bundles/acmedemo/images/welcome-quick-tour.gif') }}" alt="Quick tour" />
-            </div>
-            <a href="http://symfony.com/doc/{{ version }}/quick_tour/index.html" class="sf-button sf-button-selected">
-                <span class="border-l">
-                    <span class="border-r">
-                        <span class="btn-bg">Read the Quick Tour</span>
-                    </span>
-                </span>
-            </a>
-        </div>
-        {% if app.environment == 'dev' %}
-            <div class="block-configure">
-                <div class="illustration">
-                    <img src="{{ asset('bundles/acmedemo/images/welcome-configure.gif') }}" alt="Configure your application" />
-                </div>
-                <a href="{{ path('_configurator_home') }}" class="sf-button sf-button-selected">
-                    <span class="border-l">
-                        <span class="border-r">
-                            <span class="btn-bg">Configure</span>
-                        </span>
-                    </span>
-                </a>
-            </div>
-        {% endif %}
-        <div class="block-demo">
-            <div class="illustration">
-                <img src="{{ asset('bundles/acmedemo/images/welcome-demo.gif') }}" alt="Demo" />
-            </div>
-            <a href="{{ path('_demo') }}" class="sf-button sf-button-selected">
-                <span class="border-l">
-                    <span class="border-r">
-                        <span class="btn-bg">Run The Demo</span>
-                    </span>
-                </span>
-            </a>
-        </div>
-    </div>
-
-    <div class="symfony-blocks-help">
-        <div class="block-documentation">
-            <ul>
-                <li><strong>Documentation</strong></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/book/index.html">The Book</a></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/cookbook/index.html">The Cookbook</a></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/components/index.html">The Components</a></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/reference/index.html">Reference</a></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/glossary.html">Glossary</a></li>
-            </ul>
-        </div>
-        <div class="block-documentation-more">
-            <ul>
-                <li><strong>Sensio</strong></li>
-                <li><a href="http://trainings.sensiolabs.com">Trainings</a></li>
-                <li><a href="http://books.sensiolabs.com">Books</a></li>
-            </ul>
-        </div>
-        <div class="block-community">
-            <ul>
-                <li><strong>Community</strong></li>
-                <li><a href="http://symfony.com/irc">IRC channel</a></li>
-                <li><a href="http://symfony.com/mailing-lists">Mailing lists</a></li>
-                <li><a href="http://forum.symfony-project.org">Forum</a></li>
-                <li><a href="http://symfony.com/doc/{{ version }}/contributing/index.html">Contributing</a></li>
-            </ul>
-        </div>
-    </div>
-{% endblock %}

File src/Acme/DemoBundle/Resources/views/layout.html.twig

-{% extends "TwigBundle::layout.html.twig" %}
-
-{% block head %}
-    <link rel="icon" sizes="16x16" href="{{ asset('favicon.ico') }}" />
-    <link rel="stylesheet" href="{{ asset('bundles/acmedemo/css/demo.css') }}" />
-{% endblock %}
-
-{% block title 'Demo Bundle' %}
-
-{% block body %}
-    {% for flashMessage in app.session.flashbag.get('notice') %}
-        <div class="flash-message">
-            <em>Notice</em>: {{ flashMessage }}
-        </div>
-    {% endfor %}
-
-    {% block content_header %}
-        <ul id="menu">
-            {% block content_header_more %}
-                <li><a href="{{ path('_demo') }}">Demo Home</a></li>
-            {% endblock %}
-        </ul>
-
-        <div style="clear: both"></div>
-    {% endblock %}
-
-    <div class="block">
-        {% block content %}{% endblock %}
-    </div>
-
-    {% if code is defined %}
-        <h2>Code behind this page</h2>
-        <div class="block">
-            <div class="symfony-content">{{ code|raw }}</div>
-        </div>
-    {% endif %}
-{% endblock %}

File src/Acme/DemoBundle/Tests/Controller/DemoControllerTest.php

-<?php
-
-namespace Acme\DemoBundle\Tests\Controller;
-
-use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
-
-class DemoControllerTest extends WebTestCase
-{
-    public function testIndex()
-    {
-        $client = static::createClient();
-
-        $crawler = $client->request('GET', '/demo/hello/Fabien');
-
-        $this->assertGreaterThan(0, $crawler->filter('html:contains("Hello Fabien")')->count());
-    }
-}

File src/Acme/DemoBundle/Twig/Extension/DemoExtension.php

-<?php
-
-namespace Acme\DemoBundle\Twig\Extension;
-
-use CG\Core\ClassUtils;
-
-class DemoExtension extends \Twig_Extension
-{
-    protected $loader;
-    protected $controller;
-
-    public function __construct(\Twig_LoaderInterface $loader)
-    {
-        $this->loader = $loader;
-    }
-
-    public function setController($controller)
-    {
-        $this->controller = $controller;
-    }
-
-    /**
-     * {@inheritdoc}
-     */
-    public function getFunctions()
-    {
-        return array(
-            new \Twig_SimpleFunction('code', array($this, 'getCode'), array('is_safe' => array('html'))),
-        );
-    }
-
-    public function getCode($template)
-    {
-        // highlight_string highlights php code only if '<?php' tag is present.
-        $controller = highlight_string("<?php" . $this->getControllerCode(), true);
-        $controller = str_replace('<span style="color: #0000BB">&lt;?php&nbsp;&nbsp;&nbsp;&nbsp;</span>', '&nbsp;&nbsp;&nbsp;&nbsp;', $controller);
-
-        $template = htmlspecialchars($this->getTemplateCode($template), ENT_QUOTES, 'UTF-8');
-
-        // remove the code block
-        $template = str_replace('{% set code = code(_self) %}', '', $template);
-
-        return <<<EOF
-<p><strong>Controller Code</strong></p>
-<pre>$controller</pre>
-
-<p><strong>Template Code</strong></p>
-<pre>$template</pre>
-EOF;
-    }
-
-    protected function getControllerCode()
-    {
-        $class = get_class($this->controller[0]);
-        if (class_exists('CG\Core\ClassUtils')) {
-            $class = ClassUtils::getUserClass($class);
-        }
-
-        $r = new \ReflectionClass($class);
-        $m = $r->getMethod($this->controller[1]);
-
-        $code = file($r->getFilename());
-
-        return '    '.$m->getDocComment()."\n".implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
-    }
-
-    protected function getTemplateCode($template)
-    {
-        return $this->loader->getSource($template->getTemplateName());
-    }
-
-    /**
-     * Returns the name of the extension.
-     *
-     * @return string The extension name
-     */
-    public function getName()
-    {
-        return 'demo';
-    }
-}

File src/PUGX/BookBundle/Controller/DefaultController.php

+<?php
+
+namespace PUGX\BookBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+
+class DefaultController extends Controller
+{
+    public function indexAction()
+    {
+        return $this->render('PUGXBookBundle:Default:index.html.twig');
+    }
+}

File src/PUGX/BookBundle/DependencyInjection/Configuration.php

+<?php
+
+namespace PUGX\BookBundle\DependencyInjection;
+
+use Symfony\Component\Config\Definition\Builder\TreeBuilder;
+use Symfony\Component\Config\Definition\ConfigurationInterface;
+
+/**
+ * This is the class that validates and merges configuration from your app/config files
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
+ */
+class Configuration implements ConfigurationInterface
+{
+    /**
+     * {@inheritDoc}
+     */
+    public function getConfigTreeBuilder()
+    {
+        $treeBuilder = new TreeBuilder();
+        $rootNode = $treeBuilder->root('pugx_book');
+
+        // Here you should define the parameters that are allowed to
+        // configure your bundle. See the documentation linked above for
+        // more information on that topic.
+
+        return $treeBuilder;
+    }
+}

File src/PUGX/BookBundle/DependencyInjection/PUGXBookExtension.php

+<?php
+
+namespace PUGX\BookBundle\DependencyInjection;
+
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\Config\FileLocator;
+use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\DependencyInjection\Loader;
+
+/**
+ * This is the class that loads and manages your bundle configuration
+ *
+ * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
+ */
+class PUGXBookExtension extends Extension
+{
+    /**
+     * {@inheritDoc}
+     */
+    public function load(array $configs, ContainerBuilder $container)
+    {
+        $configuration = new Configuration();
+        $config = $this->processConfiguration($configuration, $configs);
+
+        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
+        $loader->load('services.yml');
+    }
+}

File src/PUGX/BookBundle/PUGXBookBundle.php

+<?php
+
+namespace PUGX\BookBundle;
+
+use Symfony\Component\HttpKernel\Bundle\Bundle;
+
+class PUGXBookBundle extends Bundle
+{
+}

File src/PUGX/BookBundle/Resources/config/routing.yml

+pugx_book_homepage:
+    pattern:  /
+    defaults: { _controller: PUGXBookBundle:Default:index }

File src/PUGX/BookBundle/Resources/config/services.yml

+parameters:
+#    pugx_book.example.class: PUGX\BookBundle\Example
+
+services:
+#    pugx_book.example:
+#        class: %pugx_book.example.class%
+#        arguments: [@service_id, "plain_value", %parameter%]

File src/PUGX/BookBundle/Resources/translations/messages.fr.xlf

+<?xml version="1.0"?>
+<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
+    <file source-language="en" datatype="plaintext" original="file.ext">
+        <body>
+            <trans-unit id="1">
+                <source>Symfony2 is great</source>
+                <target>J'aime Symfony2</target>
+            </trans-unit>
+        </body>
+    </file>
+</xliff>

File src/PUGX/BookBundle/Resources/views/Default/index.html.twig

+Hello World!

File src/PUGX/BookBundle/Tests/Controller/DefaultControllerTest.php

+<?php
+
+namespace PUGX\BookBundle\Tests\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+
+class DefaultControllerTest extends WebTestCase
+{
+    public function testIndex()
+    {
+        $client = static::createClient();
+
+        $crawler = $client->request('GET', '/');
+
+        $this->assertRegExp("/Hello world/i", $client->getResponse()->getContent());
+    }
+}