2 min read

Symfony 6 project structure explained

Do you want to learn more about the files and directories that are added inside a Symfony skeleton project? Learn more about them right here!

If you pull in a Symfony skeleton project through the Symfony installer of Composer, a couple important directories and files will be imported in the root of the project directory. I recommend starting with a Symfony skeleton project, since it does not add many dependencies, but only the components that are needed to run a Symfony project in the browser.

/bin

Has the console file which is the main entry point.

/config

Consists of default and sensible configuration files.

/migrations

The place where database migrations will be stored.

/public

Has the index.php file which will be the main entry point for all dynamic HTTP resources.

/src

The most important directory, all code/logic you write will be stored right here.

/var

Contains all caches, logs and files that are generated at runtime by the application.

/vendor

Consists of the files that you pull in through Composer (and Symfony pulls in)

.env

The location where you store individual working environment variables that you can use throughout your application.

composer.json

Specifies common project properties, metadata, and dependencies of packages.

composer.lock

When running composer install for the first time, or when running composer update a lock file called composer.lock will be generated.

symfony.lock

The symfony.lock file is the proper lock file for Symfony recipes instead of trying to guess via the state of composer.lock.

The biggest piece of advice I can give to you is to never update/delete the vendor directory because you’ll be running into conflicts when you need to update your packages. The best way to update/delete the vendor directory is to either overwrite the vendor directory or overwrite functions, but we will get into that later on.

Conclusion 🚀

I hope that this article showed you what the imported files and directories are when creating a new Symfony skeleton project.

If you did enjoy reading this post and you want me to create an article on a topic you like, please send an email to info@darynazar.com.