Symfony 4

Symfony 4

Symfony4 has major change on directory structure.
Symfony 4 has different directory structure then symfony 3.
They to make directory structure more developer friendly.
This consolidates user experience across ecosystems.

- /var: temporary files go under /var in the root of the project folder.
/var/cache: cache will store here,

- /src source code in this folder
Kernel class is now in src folder. It uses the MicroKernelTrait trait. Then, it implements the logic to load the bundles from bundles.php and to read the various bundle configuration files.

- /config configuration files-
The new config/ directory is the same as symfony 3 app/config/ directory. parameters.yml and parameters.yml.dist are no longer in Symfony 4.

There is a main container.yaml. In that you can define parameters and services.
The main entry point for the container is an empty container.yaml that you can use to define your own services and parameters. Configuration for bundles that you install via Composer is stored as individual files. One file per bundle and per environment. The same goes for the routing configuration. That's a soft requirement for auto-configuration, but allows for a better file organization.

You can write configuration files in PHP, XML, or YAML as before. Now usage is yaml file instead of yml file.

One major change is the introduction of a bundles.php file where installed bundles are referenced.

One file per bundle and bundles.php are the two core concepts that enable Symfony to automatically manage your bundles and their configurations.

- /templates - template files
Templates are now at root directory.
This directory creates when you install twig.
So src/ only for php files. So great improvement for templates.
So it is easier for web designees.

- tests/ - test cases directory.
"autoload": {
"psr-4": {
"MyApp\\": "src/"
"autoload-dev": {
"psr-4": {
"MyApp\\Tests\\": "tests/"

- public/
Now web front controller changed to public/.
Now there is no config.php, .htaccess, favicon and apple-touch-icon, robots.txt. Because all project does not need them.