Well hey guys! You know what? I'm pumped that you're learning Symfony, because it's the hardest framework ever! Relax, I'm kidding. Symfony does have a reputation for being tough to learn, but this is a trap! Or at least, it's an outdated idea.

Look: Symfony can be incredibly simple and will put you in a position to write powerful, well-designed code, whether it's for an API or a traditional web app. And when it does get a bit more difficult, it's usually because you're learning best practices and object oriented goodness that's turning you into a better developer.

Symfony Components & Framework

So what is Symfony anyways? First, it's a set of components: meaning PHP libraries. Actually, it's about 30 small libraries. That means that you could use Symfony in your non-Symfony project today by using one of its little libraries. One of my favorites is called Finder: it's really good at searching deep into directories for files.

But Symfony is also a framework where we've taken all of those components and glued them together for so that you can get things done faster. This series is all about doing amazing things with the Symfony framework.

The Symfony Installer

Let's get our first Symfony project rolling. Head over to Symfony.com and click 'Download'. Our first task is to get the Symfony Installer. Depending on your system, this means running commands from one of these boxes. Since I'm on a mac, I'll copy the curl command and paste it into the terminal:

sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony

Copy the second command and run that to adjust some permissions:

sudo chmod a+x /usr/local/bin/symfony

This gives us a new symfony executable:


But hold on! This is not Symfony, it's the Symfony Installer: a tiny utility that makes it really easy to start new Symfony projects.

Downloading the Project

Let's start one! Run symfony new and then the name of the project. Call the project aqua_note:

symfony new aqua_note

I'll tell you more about it soon. In the background this is downloading a new Symfony project, unzipping it, making sure your system is configured, warning you of any problems and then dropping the new files into this aqua_note directory. Not bad!


The project name - aqua_note - is only used to determine the directory name: it's not important at all afterwards.

Move into the directory and check it out.

cd aqua_note

This is also not Symfony: it's just a set of files and directories that form a web app that use the Symfony libraries. Those libraries - along with other third-party code - live in the vendor/ directory.

Before I explain the other directories, let's get this thing working! Run:

php bin/console server:run

to start the built in PHP web server. Yes, you can also use Nginx or Apache: but this is much easier for development. When you're done later, just hit ctrl+c to stop the server.

As the comment says here, go to http://localhost:8000 in your browser. And boom! Congrats! This is your first page being executed by the Symfony framework. That's right: this is being rendered dynamically from the files inside of your project. At the bottom, you'll see one of the best features of Symfony: the web debug toolbar. This is full of debugging information - more on that later.

Ok, let's start building our own pages!

Leave a comment!

  • 2016-09-21 weaverryan

    Hi Pablo!

    Well, I'm happy you got it working, even if it meant leaving Windows aside for now :). Keep asking questions as you go through stuff - we're happy to help, and these conversations help others.


  • 2016-09-20 Pablo Aguirre

    Hi weaverryan,

    Thanks a lot for your response. I've installed Git, with Bash, but without a different result.
    I will stick to Ubuntu and maybe Mac, so I'll leave Windows out of scope for now.

    It's very funny to see the a huge marketing text convincing people to move to this philosophy, with a lack of instructions to get it installed on a major OS.
    I'm used to deal with terminals, last year I did it a lot with Apache Cordova, but with my 37yo I still surprise myself everytime using a terminal after years of OSs hiding them under GUIs :)

    Kind regards,

  • 2016-09-19 weaverryan

    Hi Pablo!

    Windows is always a *little* bit different, but it shouldn't be *too* different actually in this case :). Here are a few tips:

    1) You *will* need to find a terminal and use it - that's just part of programming in Symfony. If you don't have a terminal you like already, I recommend installing git - which has nothing to do with terminals, but comes with a great "git bash" utility after you install it. Another good one is of course cygwin

    2) The installation instructions for installing the Symfony installer are just a little bit different on Windows, but you can find them here: (click "install the Symfony installer" to reveal them): http://symfony.com/download

    3) After that, it should be more or less the same: you'll run "symfony new aqua_note" to download the Symfony project, and can start the built-in web server with the same comment.

    Let me know if this helps, or if you have any other questions!


  • 2016-09-18 Pablo Aguirre

    Hello everybody. Is there a set of steps to install Symfony on Windows? Do you know where to find detailed information on Windows setup? Thanks in advance.

  • 2016-06-26 weaverryan

    Nice solution Alex! I believe this is correct!

    Symfony *does* check for missing extensions like this. After initially installing Symfony (via the symfony new command), you *should* have seen a warning about this in your console. But, it's easy to miss, and I didn't mention to look for any warnings.

    So, good question - and thanks for the fast answer Alex Bielik!

  • 2016-06-26 Alex Bielik

    Hi, I was having the same issue. Figured out that PHP xml parser should be installed to fix this:
    sudo apt-get install php-xml

  • 2016-06-24 lolero

    I followed all the instructions but when I install a symfony project and try to run the php bin/console commands I get a fatal error:

    PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DOMDocument" from the global namespace.
    Did you forget a "use" statement? in project_folder/vendor/symfony/symfony/src/Symfony/Component/Config/Util/XmlUtils.php:52

    Any idea how to fix this?

  • 2016-06-22 Victor Bocharsky

    Ah, that explains everything! The problem not in your environment but location. Well, we can't help you with it. :( We use Vimeo API for each our screencast.

    I only can advise you to check the "Unlimited Free VPN - Hola" - it's a name of nice Google Chrome extension. I use it sometimes when have a problem with DNS. IIRC, Hola provide VPN without any advertising and has a several servers around the world.


  • 2016-06-22 Henri Tompodung

    Hi Victor!

    Because in Indonesia, the Minister of Communication and Information block vimeo. But don't worry, i can use http://unblocksites.co/ :)

    Thanks anyway...

    My browser: Chrome, FireFox, Opera
    My OS: Linux Zorin

  • 2016-06-22 Victor Bocharsky

    Hey, Henry!

    Hm, you definitely have problem with your browser. Could you provide us a bit more about your environment? What browser and OS do you use? Could you make a screenshot of problem with video loading?

    Right now, I can only suggest you to open KnpUniversity website in "Incognito window" which available in Google Chrome out-of-the-box. Did it help you?


  • 2016-06-22 Henri Tompodung

    Hi weaverryan..

    I must use http://unblocksites.co/ for watch the video :)

  • 2016-06-14 weaverryan

    Wow, cool man! Thanks for sharing - that's awesome!

  • 2016-06-14 Bruce Carvalho

    Nice realy nice! I set up a docker container with symfony ready to use, just need to pull like below:
    docker pull brucepc/symfony
    the workdir is /var/www so you can use do create your first project like below:
    docker run --rm -v [my_localdir]:/var/www -it brucepc/symfony symfony new aqua_note

  • 2016-06-11 weaverryan

    Yes! Go team!

  • 2016-06-10 Kristen Cabrera

    Bless you all! It works! Thanks so much!

  • 2016-06-09 Victor Bocharsky

    Hey Kristen!

    Ah, Ryan added very explicit and nice answer but he made a typo in 3rd command. It should be:
    sudo mv symfony.phar /usr/local/bin/symfony

    Otherwise you have `symfony.phar` file instead of `symfony` in `/usr/local/bin/` directory. So if you failed only with 4th command, then the correct command list is:

    sudo rm -rf /usr/local/bin/symfony
    cd /path/to/directory/that/holds/the/symfony.phar/download
    sudo mv symfony.phar /usr/local/bin/symfony
    sudo chmod a+x /usr/local/bin/symfony


  • 2016-06-09 Kristen Cabrera

    Hi! I appreciate all your help, but after i write

    sudo chmod a+x /usr/local/bin/symfony

    it says
    chmod: /usr/local/bin/symfony: No such file or directory

  • 2016-06-08 weaverryan

    Hey Kristen!

    Ah, the second error - "Permission denied" helps! I have a few questions/ideas

    1) Do you have a file located at /usr/local/bin/symfony ? Your error suggests that you may have this. If you do, is it a directory? And if it is a directory, does it have a symfony file inside? If you have a "symfony" directory, I think something messed up originally during setup for some reason. If this is your situation, try this. The second command (cd) should move you into the directory where the symfony.phar file was downloaded to (when you clicked the link that Victor Bocharsky sent).

    sudo rm -rf /usr/local/bin/symfony
    cd /path/to/directory/that/holds/the/symfony.phar/download
    sudo mv symfony.phar /usr/local/bin
    sudo chmod a+x /usr/local/bin/symfony

    2) If the above situation is not true (you do not have a /usr/local/bin/symfony directory), then I would try the mv command you tried above, but with "sudo" in front of it.

    Overall, I think there may have been a network error when your first downloaded the symfony.phar file, and this caused the remainder of the process to mess some things up. If we clean things up, we should be good again. Either way, let us know what you find out and we'll fix this :).


  • 2016-06-08 Kristen Cabrera

    It says: mv: symfony.phar: No such file or directory or mv: rename symfony.phar to /usr/local/bin/symfony/symfony.phar: Permission denied

  • 2016-06-08 Victor Bocharsky

    Hey Kristen!

    It's weird. Could you try to download this installer manually? Use this link https://symfony.com/installer to download it and then move downloaded `symfony.phar` file to the `/usr/local/bin/symfony` and set permissions with `sudo chmod a+x /usr/local/bin/symfony`.


  • 2016-06-07 Kristen Cabrera

    Hi, Unfortunately I got the same error again. :(

  • 2016-05-31 weaverryan

    Hey Kristen!

    Try it again and let me know if you have issues. It looks like the installer failed to download. Symfony.com *did* have some downtime a few days ago - it could just have been bad timing.


  • 2016-05-31 weaverryan

    Hi Henri!

    Hmm, it must have been a momentary problem with our video host (Vimeo). If you keep having issues, let me know!


  • 2016-05-28 Kristen Cabrera

    I keep getting curl: (23) Failed writing body (0 != 15930) and then chmod: /usr/local/bin/symfony: No such file or directory

  • 2016-05-26 Henri Tompodung

    Hi all.. Why the video could not be loaded?

  • 2016-05-11 weaverryan

    Hi Alex!

    Ah, thanks very much for the feedback! There's a few interesting things here:

    A) You were correct to install php-cli. This actually should have been enough to use the symfony command (the symfony command, even though it doesn't end in ".php" is actually a php file). Basically, as long as you can type "php" from the command line, the symfony installer will fire. But, installing LAMP is fine too of course :)

    B) The problem with DomDocument is very interesting! After you use the Symfony installer to download Symfony, it checks your system setup and reports any problems. At this point, it *should* have reported that you were missing this extension - here's the code that runs that: https://github.com/sensiolabs/.... But, perhaps this just wasn't very obvious and you missed it?

    C) Overall, you're right about having some more setup things. There are just so many systems and ways to install php. And *most* of them come with everything you need... but not always - like in your case :). And yes, that can be very frustrating. So, it's something we're thinking about - but we also need to make sure it actually covers people's cases and stays up to date. But anyways, I hear you :). We *are* (in the very short-term) planning on updating the README files that come with the code downloads to be very specific to the setup you need - that might help bridge a lot of the issues.

    Anyways, thanks for sharing - and I hope you can go on from here and get to learning some more interesting things :).

  • 2016-05-08 Alex Bielik

    Had some troubles getting it working.

    You see I'm a Windows 10 user, however I can't help myself but have a linux working

    environment. So I went through the trouble and installed 16.04 LTS Ubuntu on a VM

    via virtualbox (bridged it for it to be actually accessible via the host as well).

    Everything went OK up to the "symfony" command. However it failed to be executed and

    it stated that "'php' is not recognized as an internal or external

    command". So, it actually expects PHP to be present in the system before hand in some

    way. I've actually tried to install PHP-cli but that didn't help. So I had to INSTALL A

    LAMP server so there is actually a php being present and processed by some kind of a

    web-server somewhere. Only then was I able to run "Symfony" executable properly.

    But that's not the only thing which generated a certain amount of frustration on my behalf.

    My attempts to launch the server failed miserably with the following error:

    PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\..

    Error: Fatal error: Class 'DOMDocument' not found in /var/www/html/vendor/s


    This issue can be solved by installing the php-xml parser:

    sudo apt-get install php-xml

    Hope, that would save some time and..frustration I guess for all those future symfony

    travelers..unless you want to get an arrow in the knee like I did.

    P.S. Weaverryan: it would've been great if there was some kind of a FAQ section with all of this

    or if you guys would mention all this stuff in the prerequisites section of some kind or something

    like that. There are also other courses which would greatly benefit with some additional info

    (e.g. the behat courses). Don't get me wrong, I highly expect your work you guys been doing, but

    sometimes those unexpected issues come out of nowhere. Considering, I'm more of a noob-saibot (in a bad way)

    rather than a problem-solver, this kinda frustrates me. :)

  • 2016-03-03 weaverryan

    Ah, that makes sense! I'm glad we got it sorted out :)

  • 2016-03-01 Favian Ioel P

    hi , thanks for the help , it's working - This is what got me confused , i stoped the server before i checked the localhost :)) " When you're done later, just hit ctrl+c to stop the server."

  • 2016-02-29 weaverryan

    Hmm, that seems to me like the built-in web server isn't running! Did you run the "bin/console server:run" command? And if so, did it show any errors? If you're inside of a VM, you'll need to run "bin/console server:run", and then use your VM's ip address to access the site (e.g.

    Let me know if that helps!

  • 2016-02-27 Favian Ioel P

    i have an issue , after the install wen i go to localhost:8000 the browser says " This webpage is not available ".
    what's wrong ?

  • 2016-01-26 weaverryan

    Hey there!

    If you're using Windows (it looks like you are), then some command line items will be slightly different. Specifically, downloading the installer is a little different. The Windows instructions can be found here: http://symfony.com/doc/current....

    Based on your comfort level, you might look into using a UNIX-like terminal in Windows - it'll give you console coloration, auto-complete, and you'll be able to use commands that are a lot more similar to tutorials. For example, if you have git already installed, it comes with a nice "Git bash" you can use for a UNIX-like terminal.

    I hope that helps!

  • 2016-01-26 Lino

    I keep getting "'sudo' is not recognized as an internal or external command, operable program or batch file."
    What am i doing wrong?