Symfony 5 setup - MiguelFieira/AMO-HANDBOEK GitHub Wiki

This guide is about setting up a Symfony 5 project.

Before we start make sure XAMPP is running MySQL, you will need this if you are going to use XAMPP's MySQL database later on

Xampp

Create project

There are multiple ways to create a Symfony 5 project.

Symfony CLI

You can download the Symfony CLI here, this will enable you to use symfony commands.

Once you have the Symfony binary installed use the following command:

symfony new my_project_name --full

This will create a Symfony project with the latest LTS version.

if your want a different version use --version to specify which version you want to use:

symfony new my_project_name --version=5.1

Now, go into the newly created folder for your project and run the following command to start a development server:

symfony server:start

Composer

If you want to use composer, you can use the command:

composer create-project symfony/website-skeleton my_project_name

This will create a Symfony project with the latest LTS version.

If you want a different version you can use a command like this:

composer create-project symfony/website-skeleton:5.1 my_project_name

You can use the Symfony command symfony server:start to start a development server, but assuming you don't have the CLI for whatever reason, you can install the web-server-bundle.

web-server-bundle was deprecated after Symfony 4, so we have to force a certain version in our installation.

composer require symfony/web-server-bundle --dev ^4.4.2

NOTE: Be aware this release of web-server-bundle is not intended for use with Symfony 5 and problems may occur. web-server-bundle is also deprecated and will not get any future official updates.

Now you can use the following command to run a development server:

php bin/console server:run

Continue with adding a Controller