Anatomy of a bundle

When you install Symfony (via the default installer), it comes with a very basic controller and template. That is why we can see the default Welcome! screen by visiting the following URL:

http://localhost:8000

The general folder structure for a Symfony project is as follows:

└── mava
    ├── app
    ├── bin
    ├── src
    ├── tests
    ├── var
    ├── vendor
    └── web

The folders that we are interested at the moment are src/ and app/. They contain the code and template for the Welcome! screen. In the src/ folder, we have a bundle called AppBundle with the following basic structure:

src/
└── AppBundle
    ├── AppBundle.php
    └── Controller
        └── DefaultController.php

The default controller is where the so-called handle() method passes the request and expects ...

Get Mastering Symfony now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.