Sulu news example bundle
Clone or download
alexander-schranz and wachterjohannes Fix order of grunt build task (#21)
* fix order of grunt build task

* fix path in builded files
Latest commit b1c7fc2 May 17, 2018

Sulu ExampleNewsBundle Tutorial

This is a step-by-step tutorial how to create an extension for Sulu. Each step is explained as a pull request against the previous step and with additional information in a blog-post on It was built with the releases 1.1.* of Sulu.


The master contains the whole code to run the example. The code foreach step comes in a single branch that build on the previous one. The first branch 00-symfony-bundle is a simple bundle-bootstrap which was generated by Symfony's generate:bundle command.

The steps are explained as pull requests, each building upon the previous branch and contains descriptions in form of comments and a link to the related blog-post.


To install the example use a fresh clone from sulu-standard and run following commands to clone this Repository into the right folder.

mkdir src/Example
cd src/Example
git clone NewsBundle

Apply following patch to enable and configure ExampleNewsBundle:

diff --git a/app/AbstractKernel.php b/app/AbstractKernel.php
index 8d149aa..e180d35 100644
--- a/app/AbstractKernel.php
+++ b/app/AbstractKernel.php
@@ -66,6 +66,8 @@ abstract class AbstractKernel extends SuluKernel
             // tools
             new Massive\Bundle\BuildBundle\MassiveBuildBundle(),
+            new Example\NewsBundle\ExampleNewsBundle(),
         if (in_array($this->getEnvironment(), ['dev', 'test'])) {
diff --git a/app/config/admin/routing.yml b/app/config/admin/routing.yml
index ae2ceb4..7047e47 100644
--- a/app/config/admin/routing.yml
+++ b/app/config/admin/routing.yml
@@ -88,3 +88,8 @@ client_website:
     resource: "@SuluSearchBundle/Resources/config/routing.yml"
     prefix: /admin/search
+    resource: "@ExampleNewsBundle/Resources/config/routing_api.xml"
+    type: rest
+    prefix: /admin/api

To build the translations follow the tutorial part 5.

At the end run following command to install assets of this bundle and update the database:

app/console assets:install --symlink --relative
app/console doctrine:schema:update --force

See also

  • Sulu - Source code of Sulu
  • Sulu documentation - Full documentation of Sulu
  • Sulu blog - Our developers publish periodically blog-posts
  • Sulu demo - The demo which represents the current releases
  • Sulu homepage - Introduction to Sulu and more information for decision makers