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 a response. Let's have a look in this controller:
// mava/src/AppBundle/Controller/DefaultController.php class DefaultController extends Controller { /** * @Route("/", name="homepage") */ public function...