Upgrade to Pro — share decks privately, control downloads, hide ads and more …

State of the Symfony World

State of the Symfony World

SymfonyLive Berlin 2013

Fabien Potencier

November 09, 2013
Tweet

More Decks by Fabien Potencier

Other Decks in Programming

Transcript

  1. Console Event Dispatcher Finder HTTP Foundation HTTP Kernel Yaml Process

    Routing Translation Dom Crawler Filesystem CSS Selector Browser Kit ICU Debug
  2. Form Panel in the Web Profiler Limiting Session Metadata Writes

    Quicker Access to the Profiler when working on an API A more powerful image validator Flushing stdout and stderr on a Process Easier debugging of not-found resources Using Constants for HTTP Status Code Disabling internal Validation of DomCrawler ChoiceFormFields Dumping the default Configuration for an Extension Be﬙er Console Integration with third-par﬚ Tools Namespaces auto-discovery in DowCrawler A be﬙er Callback constraint Console improvements Restrict Securi﬚ Firewalls to specific Hosts Limit a Process Run with an idle Timeout A Stopwatch Tag for Twig Be﬙er Error Messages for missing Classes and Functions Show logs in console Customize the Securi﬚ Features with ease h﬙p:/ /symfony.com/blog/category/living-on-the-edge
  3. $language = new ExpressionLanguage(); echo $language->evaluate('1 + 1'); // will

    echo 2 echo $language->compile('1 + 2'); // will echo "(1 + 2)"
  4. not foo or bar foo in ['foo', 'bar'] foo ?

    true : false foo matches "/^foo/i"
  5. access_control: - path: ^/_internal roles: IS_AUTHENTICATED_ANONYMOUSLY ip: 127.0.0.1 - path:

    ^/_internal roles: ROLE_NO_ACCESS access_control: - path: ^/_internal roles: IS_AUTHENTICATED_ANONYMOUSLY ip: 127.0.0.1
  6. /** * @Route("/post/{id}") * @Cache(smaxage="15") */ public function showAction(Request $request,

    Post $post) { $response = new Response(); $response->setLastModified($post->getUpdated()); if ($response->isNotModified($request)) { return $response; } // ... }
  7. // hello if ( 0 === strpos($pathinfo, '/hello') && preg_match('#^/hello/(?P<name>[^/]++)$#s',

    $pathinfo, $matches) && (in_array($context->getMethod(), array("GET", "HEAD")) && preg_match("/firefox/i", $request->headers- >get("User-Agent")))) { }
  8. # Get the special price if user.getGroup() in ['good_customers', 'collaborator']

    # Promote article to the homepage when article.commentCount > 100 and article.category not in ["misc"] # Send an alert when product.stock < 15
  9. Request Response response Call Controller response? expection Sub-Request terminate controller

    view resolve controller resolve arguments request exception “sub-response” content
  10. Call Controller Request Response response response? expection Sub-Request terminate controller

    view resolve controller resolve arguments request exception “sub-response” content
  11. class FooService { public function __construct(Request $request) { $this->request =

    $request; } public function doSomething() { $this->request->...(); } }
  12. class FooService { public function __construct(ContainerInterface $container) { $this->container =

    $container; } public function doSomething() { $this->container->get('request')->...(); } }
  13. use Symfony\Component\HttpFoundation\RequestStack; class FooService { public function __construct(RequestStack $requestStack) {

    $this->requestStack = $requestStack; } public function doSomething() { $this->requestStack->getCurrentRequest()->...(); } }
  14. class FooController { public function indexAction(Request $request) { $request->...(); }

    } class FooListener { public function onKernelRequest(GetResponseEvent $event) { $event->getRequest()->...(); } }
  15. 3.0