9951 explained code solutions for 126 technologies


php-symfonyHow to create a PHP Symfony example project?


Creating a PHP Symfony example project is easy and straightforward.

  1. Install the Symfony framework using the following command:
$ composer create-project symfony/website-skeleton my-project
  1. Configure the database connection in the .env file:
DATABASE_URL=mysql://db_user:[email protected]:3306/db_name
  1. Create the database:
$ php bin/console doctrine:database:create
  1. Create the database schema:
$ php bin/console doctrine:schema:create
  1. Run the Symfony server:
$ php bin/console server:run

The output should be:

 [OK] Server listening on http://127.0.0.1:8000

You have now successfully created a PHP Symfony example project.

Helpful links

Edit this code on GitHub