Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • SensioLabs Professional services to help you with Symfony
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by SensioLabs
  1. Home
  2. Documentation
  3. Installing & Setting up the Symfony Framework
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

Table of Contents

  • Running your Symfony Application
  • Storing your Project in git
  • Setting up an Existing Symfony Project
  • Checking for Security Vulnerabilities
  • The Symfony Demo application
  • Start Coding!
  • Go Deeper with Setup

Installing & Setting up the Symfony Framework

Edit this page

Warning: You are browsing the documentation for Symfony 4.1, which is no longer maintained.

Read the updated version of this page for Symfony 6.2 (the current stable version).

Installing & Setting up the Symfony Framework

Screencast

Do you prefer video tutorials? Check out the Stellar Development with Symfony screencast series.

To create your new Symfony application, first make sure you're using PHP 7.1 or higher and have Composer installed. If you don't, start by installing Composer globally on your system. If you want to use a virtual machine (VM), check out Homestead.

Create your new project by running:

1
$ composer create-project symfony/website-skeleton my-project

This will create a new my-project directory, download some dependencies into it and even generate the basic directories and files you'll need to get started. In other words, your new app is ready!

Tip

The website-skeleton is optimized for traditional web applications. If you are building microservices, console applications or APIs, consider using the much simpler skeleton project:

1
2
3
4
5
$ composer create-project symfony/skeleton my-project

# optional: install the web server bundle (explained next)
$ cd my-project
$ composer require symfony/web-server-bundle --dev

Running your Symfony Application

On production, you should use a web server like Nginx or Apache (see configuring a web server to run Symfony). But for development, it's convenient to use the Symfony PHP web server.

Move into your new project and start the server:

1
2
$ cd my-project
$ php bin/console server:run

Open your browser and navigate to http://localhost:8000/. If everything is working, you'll see a welcome page. Later, when you are finished working, stop the server by pressing Ctrl+C from your terminal.

Tip

If you're having any problems running Symfony, your system may be missing some technical requirements. Use the Symfony Requirements Checker tool to make sure your system is set up.

Tip

If you're using a VM, you may need to tell the server to bind to all IP addresses:

1
$ php bin/console server:start 0.0.0.0:8000

You should NEVER listen to all interfaces on a computer that is directly accessible from the Internet.

Storing your Project in git

Storing your project in services like GitHub, GitLab and Bitbucket works like with any other code project! Init a new repository with Git and you are ready to push to your remote:

1
2
3
$ git init
$ git add .
$ git commit -m "Initial commit"

Your project already has a sensible .gitignore file. And as you install more packages, a system called Flex will add more lines to that file when needed.

Setting up an Existing Symfony Project

If you're working on an existing Symfony application, you only need to get the project code and install the dependencies with Composer. Assuming your team uses Git, setup your project with the following commands:

1
2
3
4
5
6
7
# clone the project to download its contents
$ cd projects/
$ git clone ...

# make Composer install the project's dependencies into vendor/
$ cd my-project/
$ composer install

You'll probably also need to customize your .env and do a few other project-specific tasks (e.g. creating database schema).

Checking for Security Vulnerabilities

Symfony provides a utility called the "Security Checker" to check whether your project's dependencies contain any known security vulnerability. Check out the integration instructions for the Security Checker to set it up.

The Symfony Demo application

The Symfony Demo Application is a fully-functional application that shows the recommended way to develop Symfony applications. It's a great learning tool for Symfony newcomers and its code contains tons of comments and helpful notes.

To check out its code and install it locally, see symfony/symfony-demo.

Start Coding!

With setup behind you, it's time to Create your first page in Symfony.

Go Deeper with Setup

  • Using Symfony with Homestead/Vagrant
  • How to Use PHP's built-in Web Server
  • Configuring a Web Server
  • Installing Composer
  • Upgrading a Third-Party Bundle for a Major Symfony Version
  • Setting up or Fixing File Permissions
  • Using Symfony Flex to Manage Symfony Applications
  • How to Install or Upgrade to the Latest, Unreleased Symfony Version
  • Upgrading a Major Version (e.g. 3.4.0 to 4.1.0)
  • Upgrading a Minor Version (e.g. 4.0.0 to 4.1.0)
  • Upgrading a Patch Version (e.g. 4.1.0 to 4.1.1)
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    We stand with Ukraine.
    Version:
    Online exam, become Sylius certified today

    Online exam, become Sylius certified today

    Check Code Performance in Dev, Test, Staging & Production

    Check Code Performance in Dev, Test, Staging & Production

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of Hein Zaw Htet™, a Symfony contributor

    Thanks Hein Zaw Htet™ for being a Symfony contributor

    1 commit • 4 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Deployed on

    Follow Symfony

    Search by Algolia