Build your own PHP Framework with Symfony Components

switch($_SERVER['PATH_INFO']) {
    case '/':
        echo 'This is the home page';
        break;
    case '/about':
        echo 'This is the about page';
        break;   
    default:
        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.