How to create a new Symfony project?

To create a new Symfony project, you can use the Symfony Installer or Composer. Here are the steps for both methods:

Using Symfony Installer:

  1. Install the Symfony Installer by running the following command in your terminal:
$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony $ sudo chmod a+x /usr/local/bin/symfony
  1. Once the installer is installed, create a new Symfony project by running the following command:
$ symfony new project_name

Replace project_name with the desired name of your project.

Using Composer:

  1. Install Composer if you haven't already. You can download Composer from https://getcomposer.org/download/.

  2. Create a new Symfony project using Composer by running the following command:

$ composer create-project symfony/skeleton project_name

Replace project_name with the desired name of your project.

  1. If you want to create a full-stack Symfony project with all the necessary bundles and configurations, you can use Symfony's official distribution:
$ composer create-project symfony/website-skeleton project_name

Replace project_name with the desired name of your project.

After creating a new Symfony project, navigate to the project directory and start the Symfony development server by running the following command:

$ cd project_name $ symfony server:start

You can then access your Symfony project in a web browser by visiting http://localhost:8000.