Symfony New Project Setup

  1. cd into the directory above where you want your project to live
  2. Run:
composer create-project symfony/skeleton my-project
  1. Test your app at http://localhost:8000/. You should see the Symfony Welcome page.
  2. Initialize a git repository by running git init
  3. Open your .gitignore file and add .idea to the bottom to ignore PhpStorm IDE files
  4. Enable the Symfony plugin for this project:
    1. Go to Settings and search for Symfony
    2. Check the “Enable Plugin for this Project” checkbox

Make sure the Path to composer.json is set up:

  1. Go to Settings again and search for “composer”
  2. Make sure the “Path to composer.json:” is set as the one in the project directory

You should be ready to start coding at this point. A good place to start is in the config/routes.yaml file

Additional Setup (optional)

  • Set the web directory in preferences to public instead of web . This will help with auto-complete in Twig. You’ll need to also install the symfony/asset package (see below).
    1. Open Preferences in PhpStorm
    2. Search for symfony
    3. Change Web Directory to public

Install the symfony/asset package

composer require asset

Development Server

To start the built-in PHP development server, run:

./bin/console server:run

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.