crashed! It can´t take that long to add this simple feature! Why is our website so slow?! Can we add a new language to the site by tomorrow? Sulu CMS Batteries included! Thanks to Symfony.
system – and works by accepting a set of prioritized Routers – The Symfony default Router is registered with the highest priority – DynamicRouters handle all the dynamically defined routes (pages, redirects, …)
src/AppBundle/Controller/DefaultController.php namespace AppBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; class DefaultController extends Controller { /** * @Route("/") */ public function indexAction() { return $this->render('AppBundle:Default:index.html.twig'); } }
page cache – It bypasses your application entirely, if the cache entry is valid – HTTP cache headers are used to mark a response cacheable and for how long
page cache – It bypasses your application entirely, if the cache entry is valid – HTTP cache headers are used to mark a response cacheable and for how long – Symfony comes with a reverse proxy written in PHP
page cache – It bypasses your application entirely, if the cache entry is valid – HTTP cache headers are used to mark a response cacheable and for how long – Symfony comes with a reverse proxy written in PHP – Switch to something more robust like Varnish without any problem
page cache – It bypasses your application entirely, if the cache entry is valid – HTTP cache headers are used to mark a response cacheable and for how long – Symfony comes with a reverse proxy written in PHP – Switch to something more robust like Varnish without any problem https://tomayko.com/blog/2008/things-caches-do
page cache – It bypasses your application entirely, if the cache entry is valid – HTTP cache headers are used to mark a response cacheable and for how long – Symfony comes with a reverse proxy written in PHP – Switch to something more robust like Varnish without any problem https://tomayko.com/blog/2008/things-caches-do
tags to communicate with the gateway cache – In Symfony the <esi:include/> is implemented – If the response contains ESI tags, the cache either requests the page fragment from the backend or embeds the fresh cache entry
app/Resources/views/Default/index.html.twig {# you can use a controller reference #} {{ render_esi(controller('AppBundle:News:latest', { 'limit': 5 })) }} {# ... or a URL #} {{ render_esi(url('latest_news', { 'limit': 5 })) }}
leads to multiple tables for the same data structure – Sulu’s PersistenceBundle allows to replace models via configuration – Inspired by Sylius ResourceBundle
use Sulu\Bundle\AdminBundle\Navigation\NavigationItem; class AppAdmin extends Admin { public function __construct($title) { $rootNavigationItem = new NavigationItem($title); $section = new NavigationItem('navigation.modules'); $myModule = new NavigationItem('app.my_module'); $myModule->setIcon('custom'); $item = new NavigationItem('app.my_module.title'); $item->setAction('my_module/custom'); $myModule->addChild($item); $rootNavigationItem->addChild($section); $section->addChild($myModule); $this->setNavigation(new Navigation($rootNavigationItem)); } }
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; class AppCompilerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { $definition = $container->getDefinition('sulu_contact.contact_manager'); $definition->setClass(CustomContactManager::class); $definition->addArgument(new Reference('app.my_custom_service')); } }
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; class AppCompilerPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { $definition = $container->getDefinition('sulu_contact.contact_manager'); $definition->setClass(CustomContactManager::class); $definition->addArgument(new Reference('app.my_custom_service')); } } // src/AppBundle/AppBundle.php namespace AppBundle; use AppBundle\DependencyInjection\AppCompilerPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; class AppBundle extends Bundle { public function build(ContainerBuilder $container) { $container->addCompilerPass(new AppCompilerPass()); } }