Build your own PHP Framework with Symfony Components

switch($_SERVER['PATH_INFO']) {
    case '/':
        echo 'This is the home page';
    case '/about':
        echo 'This is the about page';
        echo 'Not found!';

Good introduction on the Sitepoint website to getting started with a few of the Symfony Components. Starts with the example code above and – one by one – introduces the very basic Symfony Components into the code. Components covered:

  • HttpFoundation
  • HttpKernel
  • Routing
  • EventDispatcher

Build your own PHP Framework with Symfony Components →

Related: bramus/router, my own PHP routing component which I use in my courses. Other typical classes – such as Request and Response classes and their derived variants such as JsonResponse for example – which would accompany this router do exist, yet I haven’t gotten to publishing them.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.