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.

Tip

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!

  • 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

    Hey,

    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!

    Cheers!

  • 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, http://cmder.net/ 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.

    Cheers!

  • 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: https://help.github.com/articl....

  • 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 (atom.io) 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.

    Cheers!

  • 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!