This tutorial has a new version, check it out!

Setup! PhpStorm + git

I've already opened the project in PhpStorm. It is by far the best editor for working with Symfony. And I'm not even getting paid to say this! Though, if there are any PhpStorm employees watching, I do accept payment in ice cream.

Anyways, it's awesome, but not free, but totally worth it. It has a free trial: so go download it and follow along with me.

The PhpStorm Symfony Plugin

To get really crazy, you'll want to install the amazing, incredible Symfony plugin. This thing makes Symfony development so absurdly fun, I'm going to walk you through its installation right now.

In Preferences, search for Symfony and click the plugins option. From here, click 'Browse Repositories` and then find the Symfony Plugin. You'll recognize it as the one with over 1.3 million downloads.


You should also find and install the PHP Annotations plugin. That will give you the awesome annotations auto-completion that you'll see in the video.

I already have it installed, but if you don't, you'll see an Install Plugin button. Click that and then restart PHPStorm. Once you're back, go into Preferences again and search for Symfony to find the new "Symfony Plugin" item. To activate the magic, click the "Enable Plugin for this Project" checkbox. Do this once per project. Oh, and also make sure that these paths say var/cache instead of app.

Go Deeper!

If you're interested in more PHPStorm tricks we have an entire screencast on it for you to enjoy.

Starting the git Repository

Ready to code? Wait! Before we break stuff, let's be good developers and start a new git repository. Our terminal is blocked by the built-in web server, so open up a new tab. Here, run:

git init
git add .
git status

The project already has a .gitignore file that's setup to avoid committing anything we don't want, like the vendor/ directory and the file that holds database credentials. Hey, thanks Symfony! Make the first commit and give it a clever message... hopefully, more clever than mine:

git commit

Leave a comment!

  • 2018-10-02 Victor Bocharsky

    Hey Dion,

    You can try their Early Access Program that have trials: - I hope it helps you. But if you're working every day with PhpStorm - buying license worth it IMHO.


  • 2018-10-01 Dion Dresschers

    "[PHPStorm] is by far the best editor for working with Symfony", but it is not Open Source and uses a subscription license... I think I pass for now and try the Eclipse PDT first...

  • 2017-12-24 Mehdi Marchouk

    Thank you for taking the time to write this wonderful answer!
    I go with using TDD.

  • 2017-12-19 Victor Bocharsky

    Hey Mehdi,

    Yes, for educational purposes and mostly tutorials are focused on a specific set of topics, but actually this is exactly what you do when developing a real project (you just can have more topics in your project at once). Well, first of all, you need to get a project specification, i.e. what features your project should have. Then, you need to prioritize them - you'd probably want to start with most important features, i.e. with a basic set but constantly improve them. Also, there're a few "hipster" methodologies like TDD and BDD, when you write tests first and only then write code. You can take a look at our new PHPUnit course when we show what' TDD in practice: and Behat course if you wonder about BDD: .

    But in general, the process *is* the same we show in our screencasts. First of all, you need to have a task with described feature you're going to implement. And then, if you like TDD/BDD, you write a test and then write code to pass the test. Then just repeat the same for a new feature :)


  • 2017-12-18 Mehdi Marchouk

    Hi there,
    I wanna ask you a general question.
    This symfony's track is about realizing websites for educational purpose.
    After setting up PhpStorm and git and creating the project, what are your steps which you use when you realizing real websites in symfony??
    Thank you.

  • 2017-10-02 Diego Aguiar

    That's weird, maybe you would like to open a ticket to Symfony's plugin community.

    The best way to know if it works, is trying it out :)
    Check if you have autocompletion when linking paths in your twig templates. Autocompletion when fetching a service through Controller's get method, and things like that

  • 2017-10-02 Pablo

    Still the same...

    Twig Support and PHP Annotations already installed :( Have no idea.

    Maybe I just need only "Code Folding"? How can I verify that
    PHP Annotator
    PhpTypes Resolver
    Twig Annotator

    actually works with Symfony? Maybe not on a list but work?

  • 2017-10-02 Diego Aguiar

    Hmmm, interesting. Try re-installing Symfony's plugin, if it doesn't work, I think you have to install Twig Support and PHP Annotations too

  • 2017-10-02 Pablo

    I'm using PHPStorm 2017.2.4 and Symfony Plugin 0.14.155.

    I'm working on Lubuntu 16.04 LTS.

    Looks like on picture below:

  • 2017-10-02 Diego Aguiar

    Hey Pablo

    Which version of PhpStorm and Symfony plugin are you using? I think you only need to ugprade it, if that's not the case, let us know!


  • 2017-10-02 Pablo

    Hi, at my Symfony plugin settings I see just only "Code Folding" part (time 1:09), but on a movie are more like:
    PHP Annotator
    PhpTypes Resolver
    Twig Annotator

    I have installed PHP Annotations.

    What should I do to see all parts?

  • 2017-05-08 weaverryan

    Hey rebatch!

    Woh, nice catch! This was totally an accident - I was getting a little crazy with my clicking :). To my knowledge, nobody has noticed before - so you have good eyes :). So, there was no reason for this - code folding of all types is just fine :) (though sometimes, it can surprise beginners).


  • 2017-05-08 rebatch

    In the portion of the video where you're setting up the Symfony Plugin, you unclick the checkbox for Code Folding/Template (Twig). This occurs just after you change the paths from app/ to var/ (around the -0:43 mark). Is this intentional? If so, why?

  • 2016-12-19 weaverryan

    Hi Lazar!

    Welcome! Under Windows, I believe you should go to "File" -> "Settings" - like in this screenshot:

    Does that help! A few things *are* different in PhpStorm between Mac and Windows. I try to explain these differences a bit more in our phpstorm tutorial:

    Let me know if that helps!


  • 2016-12-19 Lazar Aleksic

    Hi there, I am on windows machine , i installed everything and downloaded phpstorm trial version. I put my project in , trying to follow with video but i cant find section PHP Storm which includes option Preferences in order to set plugins we will use in this course.

  • 2016-10-24 weaverryan

    Hey Terry!

    We don't have a tutorial on git here... but that's partly because this one is so good already: :)

    Learning all these tools is a long road, but a good one - and one that'll serve you in the future no matter what you find yourself doing. So, keep it up!


  • 2016-10-24 Terry Caliendo

    Thanks for the help. Did you do any tutorials on git? After I get a hang of Symfony I'll need to learn more about composer and git :)

  • 2016-10-24 weaverryan

    Yo Terry!

    About your first question (summarized):

    > If I copy all my files, why would I need to run Composer?

    You're absolutely right :). If you copy *all* of your files, then you don't need to run composer. But if you, for example, did a "git clone" or "git pull" on your server to get all the files... then you actually *won't* have the vendor directory, because it is ignored by git. Sorry about the confusion - the real answer is "it depends" :). It's of course always safe to run "composer install" - if all the files are already there, Composer won't try to re-download them.

    Next! About your developing on Windows versus deploying on Linux concerns. There is definitely some truth to this, but it might be as big of a concern as you think. I actually never use PHP_EOL - so it might be something needed in Windows for some things (I'm a bit ignorant about this), but it's probably not something that you'll need to worry about too often. And for directories, just make sure you always use the "/" directory separator - PHP is smart enough to turn that into "\" on Windows, I believe. So, in general, there really aren't that many differences in PHP land. That being said, you do still need to worry about the same issues that anyone worries about. For example, I develop on a Mac and deploy to Linux (so, similar systems, but not identical). And while I'm not worried about any EOL type of things, I *do* need to make sure that I have similar PHP versions installed locally and on my server, and that both machines have the proper PHP extensions that I'm using, etc.

    There's not one solution to all of this... because honestly... there are so many different ways to deploy and to build your servers (we have a tutorial on Ansible coming out soon, which you can use to make sure your servers are built perfectly and have all the right things installed). The best thing to do might be to at least have a staging/beta deploy where you can test things before sending them to production. This would be either a server that you can reasonably make sure is "identical" to production, or just another directory / virtual host on the same server (a lot depends on how "big" your infrastructure and traffic is - we honestly still have staging & production on the same 1 server).

    Ok, I'll end my babbling. Let me know if you have more questions - happy to help - it's a wide open area, hence my long answers... :)


  • 2016-10-22 Terry Caliendo

    Also.. in step 1) you say to get your code up to the server, then step 2) is to install composer vendors. Won't all the files composer already be installed if I just copy my entire folder structure from my local machine to the remote server? I'm new to Composer so I must be missing something... will it find files that are more specific to the server (ie if the PHP version is different)?

  • 2016-10-22 Terry Caliendo

    I guess my issue is that I work on a Windows machine and my server is Linux. Thus, if I develop locally on a Windows machine and upload to Linux production, I may have errors related to the differences in OS (for instance, say I forget to use PHP_EOL or call a filename where the directory or name causes issues on Linux that isn't a problem on Windows, or maybe the PHP version is different... I don't have a great example, but hopefully you get the idea). That has to be common, and I'm curious if you know what people are doing?

  • 2016-10-21 weaverryan

    Hey Terry!

    You're absolutely right - you probably don't want to actually develop up on your server (some people actually *do* do this, but it's not totally normal, and it requires setting something up, for example, that auto-syncs up to your server on save, so that you can have the files locally). A better setup is to develop locally (or perhaps locally inside a virtual machine) and then deploy your code up there.

    How to deploy? We actually don't have a (recent) tutorial on this, in part, because it's a changing area and there are so many potential tools, options, or even services! But, I do have one older tutorial, which still covers the essential steps - it's for Symfony 2, so a few minor things have changed:

    But, the essential deploy steps are pretty simple:

    1) Get your code up to the server (there are several valid ways to do that)
    2) Install your composer vendors

    composer install --optimize-autoloader

    (the extra flag here is a small performance boost)

    3) Clear your cache and maybe execute doctrine migrations

    bin/console cache:clear --env=prod
    bin/console doctrine:migrations:migrate --env=prod

    ... and that's about it! Here on KnpU, even to this day, we use a simple shell script to do execute all of this (which is kind of crazy, but it still serves us well enough that we haven't changed it yet)/. We also use for some of our services - which is a nice way if you *don't* like to manage your servers.

    Also, the official Symfony guide on this is also good - it'll give you some similar information:

    I hope that helps - let me know if it does/doesn't!


  • 2016-10-20 Terry Caliendo

    Is there a tutorial on how to develop locally and then deploy to a server? I run a CentOS 6 LAMP server. I can't develop on the server as everything is done via command line (ie there's no graphical user interface to use PHPstorm on).

  • 2016-09-26 Victor Bocharsky

    You're welcome, it's really a little known fact.

  • 2016-09-26 Maksym Minenko

    Thanks a lot for this EAP advice. I've never heard of it before somehow. :)

  • 2016-09-26 Victor Bocharsky

    Hey Maksym,

    JetBrains has educational licenses for real classes but not for online education. Actually, NetBeans is a good IDE too, probably it not so good working with Symfony as PhpStorm. I'd give the 2nd place to it after PhpStorm.

    P.S. PhpStorm EAP is free, you just need to update it each month to the newest beta version.

  • 2016-09-26 Maksym Minenko

    As far as I know, JetBrains has some educational licenses. Have you tried to negotiate those? :)

    P.S. Personally I find Netbeans (after some tweaking) more than enough as an ide. Maybe not the fastest one, but at least it's free.
    Symfony 3 support is out of the box -- no need to install additional plugins at all.

  • 2016-08-04 Victor Bocharsky


    Because of new Symfony 3.0 directory structure. In this video, Ryan uses Symfony 3.x, where "cache/" directory lives in "var/" instead of "app/". If you use old Symfony structure - keep it as is! In fact, you just need to specify a valid relative path to the cached "translations/" directory and "appDevUrlGenerator.php" file in your project, that's it!


  • 2016-08-03 3amprogrammer

    Why we had to change 'app' for 'var'?

  • 2016-07-04 keiosweb

    protip: get yourself cmder with git support (the full version). I used it for a very long time when I had to use Windows laptop to manage my servers and projects during travels. But hey, there isn't much to tell, visit their website and check the screenshots :)

  • 2016-04-29 weaverryan

    Awesome - enjoy!

  • 2016-04-29 BondashMaster

    I got it. I compare the Script photos with my code in PhpStorm instead of comparing with the ones in the video. They match with the ones in the video. Thanks.

  • 2016-04-29 weaverryan

    Hmm, that's odd - I also use the darcula theme that comes standard with PHPStorm, and I haven't made many changes. How "different" does your's look? What operating system?

  • 2016-04-28 BondashMaster

    I got the phpstorm and mark dracula theme, mark the symfony plugin but my colors are distinct. I would like to have the same as the tutorial to know Im coding properly.

  • 2016-04-24 weaverryan

    Hi Favian!

    You have a really good attention to detail - I'm impressed :). My OS *is* a Mac. If you see Ubuntu (or something else) in my terminal tab, it's because I ssh'ed to an Ubuntu machine before recording the tutorial, and (for some reason) that title "sticks" even after I exit from ssh.


  • 2016-04-24 Favian Ioel

    What OS do you use , I guess is Mac but in some tutorial I saw the title of the terminal was Ubuntu .

  • 2016-03-24 Hermen

    Top tip: If you haven't installed it yet, also install the plugin 'PHP Annotations' for the autocompletion in annotation and auto-inserting use statements for classes in the annotations. I thought this was a feature of the Symfony Plugin, but it seems it is not.

  • 2016-03-17 weaverryan

    I like "Git Bash" the best, simply because it's "great" and it's so easy to install: just install "Git" and you automatically have it. The GitHub article about install git references the "Git Shell" utility:

  • 2016-03-17 Andrew Grudin

    Which UNIX-like terminal for Symfony development would you recommend?

  • 2016-03-14 weaverryan

    Hmm, that *is* weird! But yes, Atom is a great editor to o- I'm glad there are good packages for Symfony & Twig! Cheers!

  • 2016-03-12 Eddy de Boer

    I could not get the Symfony autocompletion working in phpstorm (checked all settings like a billion times).
    I tried atom editor ( with the following packages: atom-autocomplete-php, atom-symfony2, php-twig; this worked like a charm.

  • 2016-03-08 weaverryan

    Hey Andrew!

    You nailed the issue :). First, you can of course download a GUI if you'd like to handle your git repository. GitHub itself has one that's very nice. OR, yes, you can use a UNIX-like terminal. For whatever reason, when you install git itself on Windows, it comes with a "Git Bash" utility that is *awesome*. I usually recommend that Windows users try this out. In general, having a UNIX-like terminal for Symfony development will help a lot - commands will work as expected and you'll get cool terminal colors :D.


  • 2016-03-07 Andrew Grudin

    My windows terminal (cmd) doesn't swallow ( git init ) command. May be there is a slightly differet analog command for windows,
    or have I to use UNIX-like terminal for starting the git repository ?
    Best regards!