This tutorial has a new version, check it out!

Start Project

Video not working?

It looks like your browser may not support the H264 codec. If you're using Linux, try a different browser or try installing the gstreamer0.10-ffmpeg gstreamer0.10-plugins-good packages.

Thanks! This saves us from needing to use Flash or encode videos in multiple formats. And that let's us get back to making more videos :). But as always, please feel free to message us.

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

  • 2020-06-19 Diego Aguiar

    Hey tSouhaieb

    Yea... Symfony doesn't really want to you start a project with the old structure, it's really painful to do the switch later but for learning purposes it makes sense :)
    Thanks for sharing it with others. Cheers!

  • 2020-06-18 tSouhaieb

    as of now (2020), the only way i found to install symfony 3 with the same folder hierarchy like in the video, is to clone `` (the exact commit id i used is `cd07a8d`), i was able to finish `Joyful Development with Symfony 3` without any problem, (my OS is ubuntu 20.04), it may help somebody start learning 3.

  • 2018-09-25 Victor Bocharsky

    Hey Serge,

    Yes, it's still the best option for 2.x/3.x versions, but for new Symfony 4 user composer create-project command.


  • 2018-09-25 Serge Boyko

    I can still use this command, but you need to specify Symfony version:
    `symfony new aqua_note 3.4` (works only for Symfony 3.x)

  • 2018-09-14 Victor Bocharsky

    Hey Ya,

    Here's where this error message from:

    Symfony installer is not a recommend way to install Symfony, starting with Symfony 4. As suggested: - use "composer create-project" command.


  • 2018-09-11 Ya Robertovich

    after entering the command "~$ symfony new aqua_note" I get an error:

    The Symfony Installer is not compatible with Symfony 4.x or newer versions.
    Run this other command to install Symfony using Composer instead:
    composer create-project symfony/skeleton aqua

    Is this a command from Symfony 4.x?

  • 2017-12-25 Mukesh Kumar

    Thanks Victor for your help :).
    I try Symfony 3.1 its work fine.

  • 2017-12-25 Victor Bocharsky

    Hey Mukesh,

    Are you on Symfony 3.4? Looks like it was a known problem in WebServerBundle: which was fixed in: . But probably there's no a release for this fix, wait for 4.0.3 tag or use dev-master instead for WebServerBundle.


  • 2017-12-24 Mukesh Kumar

    I am facing this error when I run my Symfony project, please help me.

    Warning: require(index.php): failed to open stream: No such file or directory in C:\test\aqua_note\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle\Resources\router.php on line 42

    Fatal error: require(): Failed opening required 'index.php' (include_path='.;C:\Acquia-Server\common\pear') in C:\test\aqua_note\vendor\symfony\symfony\src\Symfony\Bundle\WebServerBundle\Resources\router.php on line 42

  • 2017-11-27 Diego Aguiar

    Hmm, interesting... that's not my area of expertise, but try starting the server like this:
    $ php bin/console server:run

    If that doesn't work, can you contact your network admin? maybe he has some ideas

  • 2017-11-24 Spiro Ciko

    I try it to solve the problem but i cant i want to open on my own database example spyros.asdfsdfssdf/aqua_note

  • 2017-11-23 Diego Aguiar

    Hey Spiro Ciko

    Did you solve your problem? if port 8000 is not open in your shared host, try with a different one


  • 2017-11-23 Spiro Ciko

    The symfony its installed and its listening on localhost:8000. Symfony its installed on Z: A network Location

  • 2017-11-23 Spiro Ciko

    Hi !. I cant open the symfony on localhost:8000.. I use a network sharing host.. And i dont find the way to install it over there and to use it on that URL not in localhost but its not working in no one of this. I followed every step.. Thanks

  • 2017-07-14 weaverryan

    That's a good question. I believe "yes" - most of the items in the table of contents have not fundamentally changed from Symfony 2 to Symfony 3. You'll probably need to do some translational things (like knowing when it says app/console that this is bin/console in Symfony 3), but I think it's still going to be really solid.


  • 2017-07-14 julien moulis

    Hey Ryan,
    The book is about symfony 2, is it still accurate to use it for the certification symfony 3?

  • 2017-07-13 julien moulis

    Thank you so much! I don't know if you realize how much you helped, first with the courses and with all the gréât answers you gave me everytime I needed. Thanks.

  • 2017-07-13 weaverryan

    Yo julien moulis!

    I can do my best to give you some advice :). The certification exam is hard, and *very* broad: it touches in pretty much every part of the Symfony full stack framework. So basically, if you expand the "Guides" navigation on the left - - any of those topics are in play. Here's the best course of action:

    A) Of course, go through the KnpU Symfony 3 track ;). I know you've already done a lot

    B) Read the entire Symfony documentation. Ok, not the *entire* documentation. But, definitely read all top-level articles. Then, at the bottom of each top-level article there is a "Learn More" section. Sometimes these are very specific and esoteric and you can probably skip. But other times these contain really important stuff, and was moved into a different article just so the main article wasn't 50 pages long. Security ( is an example where much of the "Learn More" are pretty important.

    C) Code some apps up and try to use each big Symfony feature (the stuff under guides) in that. It's been a few years since I took the test, but iirc, the exam is less about terse memorization of random things, and more real-world familiarity with using the features. It won't ask you what the second argument to some low-level function is, but it might show you 3 code examples of how to attach an event listener to a form field and ask you which is correct (the other 2 being good-looking fakes!).

    D) And finally, check out: I haven't used this, but I know the author and I also know that this was at least reviewed by Fabien (in order to "ok" the usage of Symfony).

    And of course, tell us how the exam goes when you take it!


  • 2017-07-12 julien moulis

    Hi everyone. I would like to prepare for symfony 3 certification. Do you have any advice? I followed you courses and studied the demo app and coded few apps. Thanks a lot

  • 2017-05-30 Victor Bocharsky

    Hey Seth,

    We're sorry about that! Do you have this problem with this video only? Or with all KnpU videos? Could you try to play it in a different browser? Do you use any vpn/proxy configuration? What country are you in? We use Vimeo API for our videos, could you play videos on in your country?


  • 2017-05-29 Robert Went

    Thanks, I was wondering where to suggest a change

  • 2017-05-29 Victor Bocharsky

    Ah, I see. I agree it will be useful to have this information in docs for Windows users. Btw, feel free to create an issue or send a PR in about it.


  • 2017-05-29 Robert Went

    Yeah, it's the docs on the official site where that step is missing -

  • 2017-05-29 Victor Bocharsky

    Hey Robert,

    Thanks for sharing it! You're right, and actually, it is in docs already: .

    Does it help you @Stefan ?


  • 2017-05-27 Robert Went

    For windows you need to crate a symfony.bat file in the same directory as the symfony file and add the lines:

    php "%~dp0symfony" %*

    I'm not sure why this isn't part of the docs as it can't work without it.

  • 2017-05-27 Seth Setiadha

    i'm using chrome, windows 10. also can not

  • 2017-05-18 KnpUniversity

    Hi Bryson; let's get this figured out! I'm not having an issue watching it on Chrome, can you give me some more details on what browser (and version) you're trying to watch the video on?

  • 2017-05-18 Bryson Lin

    Why this in my browser cannot play
    "The media not be loaded,either because the server or network failed or because the format is not supported."
    What can I do ? ?

  • 2017-05-15 Victor Bocharsky

    Hey Danny,

    Glad you figured out it by yourself. Yes, "vagrant halt" is stopping the running VM. Btw, if you want to completely remove it from your disk or just to rebuild a new VM - you can run "vagrant destroy". But keep in mind it also removes all the files you had in your VM box.


  • 2017-05-12 DannyandAndrea Avery

    I figured it out finally! I just needed to run "vagrant halt" on my Homestead VirtualBox. Thanks!

  • 2017-05-12 DannyandAndrea Avery

    So, I installed laravelangular Material Starter a while back and I don't know how to get it off or stop listening so that when I visit localhost:8000 I don't see the "laravelangular Material Starter" start page. Would you know how I can stop it so I can see my Symfony project? Thanks!

  • 2017-04-27 Victor Bocharsky

    Hey Brian,

    Great! Brew is a Mac package manager like an APT for Ubuntu/Debian, so if you need some php extension - now you can control all of this with Brew, e.g. brew install homebrew/php/php71-xdebug. And actually it has a lot of other packages, like NGINX, MySQL, etc. ;)


  • 2017-04-26 Brian

    Worked! Thank you so much for your help Victor!


  • 2017-04-26 Victor Bocharsky

    Hey Brian,

    How did you install PHP? I use Brew package manager to manage it: .
    I suppose something was wrong with our installation. Could you try to install/reinstall it with Brew?

    $ brew update
    $ brew install homebrew/php/php71


  • 2017-04-25 Brian

    Thanks for the tip, but it still does not work. Created a folder for "/etc" and put a blank "php.ini" file inside. It showed the same thing as above.

    Thanks for your help :)

  • 2017-04-25 Brian

    Thanks for the tip Victor. I am using the latest version of mac sierra


  • 2017-04-25 Victor Bocharsky

    Hey Brain,

    Oh, it's weird... What OS do you use? Try to create an empty "php.ini" in "/etc" folder, it should have /etc/php.ini path. Then try to execute "php --ini" again. What output will it show to you this time? I suppose your "Loaded Configuration File" should be "/etc/php.ini", right?


  • 2017-04-24 Brian

    Thanks Victor,

    I go to my (php --ini) and It shows me this,

    Configuration File (php.ini) Path: /etc
    Loaded Configuration File: (none)
    Scan for additional .ini files in: (none)
    Additional .ini files parsed: (none)

    Not sure what to do next?


  • 2017-04-24 Victor Bocharsky

    Hey Brain,

    If you close your terminal, I don't think you have a way to recover it, that's why I use confirmation box before closing the terminal which prevent it. But all your commands are stored in the history, and you can iterate over them by pressing "Up" key. So if you enter something "cd /path/to/the/dir" - you'll find it in history. If you have huge history and don't want to iterate it long time - use the "Control" + "R" combination, in my terminal it's a regexp search in history, so I can quickly find all "cd" commands by pressing "Control" + "R" and then typing "cd".

    I hope it helps, but anyway if you had SSH session and close your terminal - you have to ssh-ed into the server again. Or probably should help with it, but I haven't used it yet.


  • 2017-04-24 Victor Bocharsky

    Hey Brain,

    It's a one-time action, you don't have to set the timezone again if you close your terminal, it just should work well. If you mean finding your php.ini path - well, it's permanent path for your system, you just need to remember it. But if you forget - no problem, now you already know how to find it again ;)


  • 2017-04-23 Brian

    Hey, just curious if there is a way to get back to where I was? Had a time and date issue, but I accidentally closed out of the terminal, and cant seem to get it back. Should I start over? Thanks!

    Any tips appreciated :)

  • 2017-04-21 Brian

    Hey Victor!
    Thanks for getting back to me. Bit issue (at least to me haha), I checked back to see what was said here, and I realized I exited out of the terminal. Is there a way to recover and get back to this step? Or do I have to do it again?


  • 2017-04-21 Victor Bocharsky

    Hey Stefan,

    Hm, interesting. Could you try a way described here: - there's also a few steps how to solve this error for your system. And yeah, installation could be done with Composer, see the Creating Symfony Applications with Composer section in this article for help. Actually, you just need to execute "composer create-project symfony/framework-standard-edition my_project_name" command and that's it. You just have to wait a bit when composer install all the dependencies, but it's always a good fallback ;)

    P.S. yeah, we do not support image uploading for Disqus comments, but you can upload screenshots to the public cloud storage like Imgur, or share image link on your Google Drive. Then just paste the link to it in your comment. Sorry for any inconvenience.


  • 2017-04-21 Stefan

    Thank you for the quick reply.
    does not work,
    I downloaded the file placed in the tutorial, changed
    php.ini, restarted the wamp, the problem still occurs ...

    Ps. In the previous post I tried to post a screenshot, but the picture apparently did not pass

    Ps.2 I also tried several solutions from youtube but the same result
    I will try composer because this problem can not be solved

  • 2017-04-21 Victor Bocharsky

    Hey Stefan,

    This error was solved on StackOverflow: . Could you look at this solution? Does it help you?

    P.S. now I understand what do you mean in another your message: . But please, could you post your question in one message? This way we will have all the context in one place, so it will have more sense and easier for us to handle it :)


  • 2017-04-21 Stefan

    C:\wamp64\symfony>symfony new test
    'symfony' is not recognized as an internal or external command,
    operable program or batch file.

    C:\wamp64\symfony>php symfony new test

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    new <directory> [<version>]


  • 2017-04-21 Victor Bocharsky

    Hey Stefan,

    What ideas do you mean? ;)


  • 2017-04-21 Stefan

    Do you have any ideas?

  • 2017-04-20 Victor Bocharsky

    Hey Brain,

    Yes, you have to set up your timezone in php.ini. You can find the path to loaded configuration file with this command:
    $ php --ini | grep '/php.ini'. You don't have path to php.ini there? Could you show the full output of `php --ini` to me? There should be "Configuration File (php.ini) Path", where you can create manually an empty php.ini, which will be used further. Write the timezone directive there.

    Actually, in this comment Ryan explain how to set up timezone well:


  • 2017-04-19 Brian

    Hello, thank you for the video! This came up as an error. How do I fix this?

    Warning: date_default_timezone_get(): It is not safe to rely on the system'
    s timezone settings. You are *required* to use the date.timezone setting or
    the date_default_timezone_set() function. In case you used any of those me
    thods and you are still getting this warning, you most likely misspelled th
    e timezone identifier. We selected the timezone 'UTC' for now, but please s
    et date.timezone to select your timezone.

    Someone else posted, and you mentioned to look for the Loaded Configuration File:... Mine says (none) after it.

    Much appreciated :)

  • 2017-03-15 Victor Bocharsky

    Hey Domatas,

    We use Darcula theme for PhpStorm: In your PhpStorm preferences go "Appearance & Behavior" -> "Appearance" -> "Theme" -> "Darcula". Btw, here's a small screencast about PhpStorm: where you'll find some basic setups we use on it.


  • 2017-03-15 Donatas Ceponis

    About PhpStorm it looks nice :)

  • 2017-03-15 weaverryan

    Yo Donatas Ceponis!

    Which theme are you asking about - terminal? Something else? I thought you might be asking about PhpStorm at first... but there is no PhpStorm in this chapter :).


  • 2017-03-13 Donatas Ceponis

    Hi, what kind of theme you using ? Thanks :)

  • 2017-02-17 Victor Bocharsky

    Hey Danang,

    We're sorry you have this problem. I just double checked and it works for me. Do you use any proxy? What browser do you use?


  • 2017-02-17 Danang Widiantoro

    I got this message, why is that?
    "the video could not be loaded, either because the server or network failed or because the format is not supported"

  • 2017-01-05 weaverryan

    Hey Hermen!

    GREAT question! Actually, I think the installation/setup process is going to simplify a little bit over the next few months, via a new (still-unreleased) new system in Symfony called "Flex", which is designed to help you start your project faster, while easily installing the bundles you need for different purposes.

    BUT, regardless of that future feature, I would recommend setting up a brand new Symfony project, getting everything just the way you like it, and then pushing this GitHub (or wherever you store your projects). This will serve as your template project. In the future, when you need to create a new project, just clone that project, delete the ".git" directory, and re-run "git init" to get a fresh new git project, but based on your "template" project. Then, if you want to make more tweaks for future projects, just update the template project. The advantage of this is that... well... it's dead-simple - you don't need to mess around with any fancy setup scripts: just create a template project and use it. And actually, when you run "symfony new aqua_note", all this *really* does is download the official Symfony "template" project ( into the aqua_note directory. There's nothing else fancy going on :).


  • 2017-01-05 Hermen

    So, I'm following 'all' your courses and coding along with it, adding bundles to my project like the DoctrineMigrationsBundle, DoctrineFixturesBundle (with nelmio/alice of course) and the StofDoctrineExtensionsBundle to name a few. Besides that I don't like Bootstrap, but instead want to use my own stylesheets, images and javascripts.

    Now, for the main price: is there a way to setup a default project just the way I like it to use every time I start a new project or do I need to repeat all the above steps every time?

  • 2016-12-19 Victor Bocharsky

    Symfony installer allows you to do it much quicker, but Installing with Composer is a good alternative way indeed :)


  • 2016-12-19 Lazar Aleksic

    I already installed composer yday but thanks for answering anyway :D

  • 2016-12-19 Victor Bocharsky

    Hey Lazar,

    Are you on Windows? Using Symfony installer on Windows is a bit different, you should move the downloaded file to your projects directory and execute it as php symfony, i.e. execute it through the PHP interpreter, for example:

    php symfony new your_project_name

    Does it help you?


  • 2016-12-18 Lazar Aleksic

    Hi, I am following the example of the video but when i type symfony new + name of the project, i get a message "'symfony' is not recognized as an internal or external command,
    operable program or batch file." . And i do have installed installer.

  • 2016-12-10 Miguel Angel Posada

    works like a champ, thanks!!

  • 2016-12-09 Victor Bocharsky

    Yes, for sure! But when you move project to the other location - don't forget to clear the cache.


  • 2016-12-09 Miguel Angel Posada

    Hi Victor,

    I'm on Mac and I'm trying to run "symfony new aqua_note" in an external Disc because the memory of my Mac is little because is a flash hard disc.

    when I run the command in the main disc it works.

    Victor, if I can move that folder to the external disc will work the same ?

    Thanks :)

  • 2016-12-08 Victor Bocharsky

    Hey Miguel,

    The installer kindly gives you a few possible problems :) In what directory are you trying to install the new aqua_note project?
    Are you on Windows? Try to change working directory to the home folder and install it again, i.e.:

    $ cd ~/
    $ symfony new aqua_note

    Does it help you?


  • 2016-12-08 Miguel Angel Posada

    Hi, I'm following the example of the video but wen I run "symfony new aqua_note" get an error: [RuntimeException]
    Symfony can't be installed because the downloaded package is corrupted
    or because the installer doesn't have enough permissions to uncompress and
    rename the package contents.

    Someone know what may be the problem ?

    Thanks in advance

  • 2016-11-17 Victor Bocharsky

    Great! Happy coding! :)


  • 2016-11-17 Nobuyuki Fujioka

    Hi, Victor

    Thank you very much. With the reinstall command you gave me, there is no more issue.

    Kind regards,

  • 2016-11-17 Victor Bocharsky

    Hey, it's the well known issue, just try to install intl extension from source: brew reinstall --build-from-source php70-intl . Here's a link for more info:


  • 2016-11-17 Nobuyuki Fujioka

    Hi, Ryan

    Everything is working except for I get these errors.
    PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/' - dlopen(/usr/local/opt/php70-intl/, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.57.dylib
    Referenced from: /usr/local/opt/php70-intl/
    Reason: image not found in Unknown on line 0

    Warning: PHP Startup: Unable to load dynamic library '/usr/local/opt/php70-intl/' - dlopen(/usr/local/opt/php70-intl/, 9): Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.57.dylib
    Referenced from: /usr/local/opt/php70-intl/
    Reason: image not found in Unknown on line 0
    PHP 7.0.12 (cli) (built: Oct 14 2016 09:55:03) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies

    They are already installed.

    Any suggestion to make these errors go away?

    Thank you,

  • 2016-11-04 weaverryan

    Sweet! Keep up the good work!

  • 2016-11-04 Nobuyuki Fujioka

    Yo Ryan!

    Thank you very much. It is now working with php7. all installed.


  • 2016-11-04 weaverryan

    Yo Noby!

    Ah, great! So, change both of those commands to be homebrew/php/php70-intl and homebrew/php/php70-opcache - each version of PHP has its own package name for the extensions. So, I think when you ran these commands, you basically installed php 5.6, and so then it told you to "unlink" (basically, stop using) PHP 7 and use php 5.6 instead. That's not a big deal, but if you want to use php 7, then I would re-install it via brew :).

    About the date.timezone warning, this is a classic first-time setup thing in PHP! It's annoying, but easy to fix:

    1) Locate your php.ini file. You can do this by running this command:

    php --ini

    Look for the path next to "Loaded Configuration File" - mine is /usr/local/etc/php/5.6/php.ini

    2) Open this file, find the date.timezone setting, uncomment it (remove the ; at the beginning if there is one) and set it to your timezone, or UTC. Examples:

    date.timezone = America/New_York
    ; or
    date.timezone = UTC

    Here's the list of valid timezones:

    3) If you have the bin/console server:run command running, press cmd+c to stop it, then run the command again. This basically "restarts" your web server :).


  • 2016-11-04 Nobuyuki Fujioka

    Hi, Weaverryan
    Thank you for your explanation.
    1. I have PHP70 in brew.
    I tried below.
    brew install homebrew/php/php56-intl
    brew install homebrew/php/php56-opcache
    But, they did not let me and told me to
    brew unlink php70
    So, I did. But, now I get the below error.
    Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezon
    e setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you m
    ost likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezon

    Now I canot run the server anymore...
    What is the issue now? Your help is highly appreciated.

    2. I signed up for your course. So, I guess I will learn how to connect it with database soon.


  • 2016-11-04 weaverryan

    Hey Nobuyuki!

    Yea, good questions!

    1) So, both the intl extension and a PHP accelerator (you should use opcache) are both good ideas :). *How* you install those... depends on how you installed PHP. I recommend installing PHP in a Mac with Homebrew. In that case, installing these extensions (once php is installed) is really easy! (The exact command will vary based on what version of PHP you choose to install):

    brew install homebrew/php/php56-intl
    brew install homebrew/php/php56-opcache

    Let me know if that helps! It won't kill you not to have them... well, probably not :). Opcache just makes things run faster (yay!) and intl is used inside certain parts of the form component for internationalization (so, if you don't use that functionality you're ok, but if you do, you'll need it).

    2) There is no database automatically created when you create your app. This is true for both the Symfony installer and installing via Composer. Symfony *does* come with some configuration (in app/config/parameters.yml) to connect to a database... but it's your responsible to create it (I usually do this through Symfony, with bin/console doctrine:database:create). When you install via Composer, what you're seeing is *not* Symfony trying to create your database. Instead, it is simply asking you what database configuration you'd like. It uses this information to create the parameters.yml file. More info here:

    Let me know if that helps! And welcome :)

  • 2016-11-03 Nobuyuki Fujioka


    I have below questions regarding the installation - I am on Mac. and Installation is done by the symfony installer.

    1. when I create a new symfony app, everything works fine, but when I go to localhost:8000/config.php, I get recommendations as below.

    To enhance your Symfony experience, it’s recommended that you fix the following:
    intl extension should be available
    Install and enable the intl extension (used for validators).
    a PHP accelerator should be installed
    Install and/or enable a PHP accelerator (highly recommended).

    Why do I get these? and is it important to fix these issues?

    2. The installer does not ask about database (as opposed to installing it via composer).
    Is a database automatically created when I create an app?

    Thank you for your help.

  • 2016-11-02 Victor Bocharsky

    Yes, this is it! You got it right ;)

  • 2016-11-01 Terry Caliendo

    Thanks Guys... Just to be fully clear, is this is what Victor is suggesting I do?

    class MySpecialUtilities

    private $requestStack;

    public function __construct(RequestStack $requestStack){

    $this->requestStack = $requestStack;

    public function SpecialService()
    $request = $this->requestStack->getCurrentRequest();
    $session = $request->getSession();
    /// start using $request here...


  • 2016-11-01 weaverryan

    Great job Terry! Victor is right about storing the $requestStack - the reasons are subtle so don't over-think that part.

    Overall, being in the framework is great... because you don't have to setup stuff your self! About your question:

    > What is Symfony doing differently when it creates the Request object?

    Actually, not much. In fact, the Request object is created in your web/app_dev.php (or web/app.php) file... which is technically your's to edit. And you'll see that it is created the same way you did, with createFromGlobals. The Session is created as a normal service by Symfony (i.e. just like the templating service, logger service, etc). Then, via an event listener (, when your app boots, it sets the Session on the Request. This whole setup is quite rare in Symfony: usually Symfony just has services, I can't think of another time that one is added to another like this via a listener.

    Keep up the good work!

  • 2016-11-01 Victor Bocharsky

    Hey Terry,

    You better store whole RequestStack object to the $requestStack property in a constructor and postpone getting current request inside methods - otherwise it could cause some errors.


  • 2016-10-31 Terry Caliendo

    Also, before your reply as I was trying to understand, I created the request object

    $request = Request::createFromGlobals();

    I was not able to get the session from this request object.


    It returned Null, which I see in the documentation that it can return a "SessionInterface" or Null.

    "createFromGlobals" documentation says it creates the Request object from PHP's superglobals. PHP's superglobals contains stuff like $_REQUEST and $_SERVER which should have the information to set up the session.

    So when Symfony sets up the Request object it contains a session that you can retrieve, but when using the code above it does not include as session and returns Null.

    What is Symphony doing differently when it creates the Request object?

  • 2016-10-31 Terry Caliendo

    Thanks for clearing that up! That helps!

    Also I I ended up needing the request in a service as well. I found this article which is old but seems to indicate to inject the @request_stack as the request object isn't a "service":

    Services YML:

    class: AppBundle\Service\MySpecialUtilities
    arguments: ['@request_stack']


    class MySpecialUtilities

    private $request;
    private $session;

    public function __construct(RequestStack $requeststack){

    $this->request = $requeststack->getCurrentRequest();
    $this->session = $this->request->getSession();}

    public function SpecialService()
    {my special code here}


    Is this how you would suggest I do this?

  • 2016-10-31 Victor Bocharsky

    Ah, that was in Components section. Check this one .

    Well, you can get Session object from Request, but I think better to inject the `session` service into your custom service if you don't use Request in it at all.

    I just use pre and code tags: check this docs page Syntax highlighting


  • 2016-10-31 weaverryan

    Oh, and about the pretty code (I made your original comment pretty), you need to surround your code with:

    echo 'cool'!

    It's kind of a pain to type, but it looks great (escaped the tags above you so you could actually see the raw HTML) :).

  • 2016-10-31 weaverryan

    Hey Terry!

    Ok, you're tripping up over something that's (unfortunately) a bit common :). Symfony is 2 things. First, it's a bunch of small libraries (called components). You can use each of these components from outside of a Symfony project. Second, Symfony is a framework: where it takes all of those libraries and glues them together for you.

    What you're reading is in the *components* section of the docs, where it's basically teaching you how you would use Symfony's session if you were installing it manually outside of a Symfony project. I know it's confusing - we have the challenge on the docs of talking to 2 different audiences: those using the Symfony framework, and those using the components standalone. As a rule of thumb, stay out of the components docs. Or, at least, realize that they will tell you how to instantiate certain objects that Symfony simply sets up for you when you're in the framework.

    Specifically in this case, Symfony sets up the Session object *for* you, so you never need to create it new. Instead, you just need to go find it. As Victor's code shows, there are actually 2 different ways to get the Session: there is a service called session, or, if you have the Request object, you can call $request->getSession(). If you need to access the session from a service, I would inject the @session service into its constructor (just like you would with any other service).

    Other than finding out *where* the Session lives, we don't talk about it much because it's super easy :). It basically has get/set/remove methods - it's kind of a glorified array: just get/set stuff on it and it works.

    Let me know if this clears it all up! I can totally understand why it was confusing :).


  • 2016-10-31 Terry Caliendo

    Thanks for the response. I'm still a bit confused... I thought I was using symfony's built-in service, per this documentation.

    Is what you are doing the same thing, but just a short cut from inside the controller?

    I forgot to add that I need access to the session from outside the controller in a Service. Is that when I'd use this line: $session = $request->getSession();


    Also... how did you get that code you pasted to show up so nicely?!

  • 2016-10-31 Victor Bocharsky

    Hey Terry,

    Better do not handle session manually - Symfony has built-in service for it. To get it in your controller just do:

    class DefaultController extends Controller
    public function indexAction(Request $request)
    $session = $this->get('session');
    // or get session object from current request
    $session = $request->getSession();

    $session->set('name', 'Drak');

    It should work well!


  • 2016-10-31 Terry Caliendo

    I'm also a little confused on the session type above and the session available in a request (ie forms). Are they tied together? Or are they separate?

  • 2016-10-31 Terry Caliendo

    Not sure where to ask this but do you have a tutorial on sessions in symfony? Specifically I'm annoyed that, from a controller, I have to call two lines to set/get a variable:

    $session = new Session();
    $session->set('name', 'Drak');

    It doesn't work for me if I leave out the first line as I get an error that $session is an undefined variable.

    It looks like I can set up a constructor in each controller that sets a property for the controller to access?

    private $session;
    public function __construct(){
    $this->session = new Session();

    Then in my controller:

    * @Route("/", name="homepage")
    public function homeAction()
    echo $this->session->get('name');

    Is this poor coding? (are we not supposed to use constructors in controller classes for some reason?)

    Also Is there any way to set up a global variable that's accessible to all my controllers so I don't have to do this work in all of them?

  • 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):

    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 :)

    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?