This tutorial has a new version, check it out!

Symfony 3 Fundamentals: Bundles, Configuration & Environments


What you'll be learning

After the first course - Joyful Development with Symfony3, you've got Symfony up and running. CELEBRATION!

In this episode, it's time to get down to work by learning the fundamental concepts of bundles, configuration and environments! We'll discover what all the files in a Symfony project do and why, the purpose of bundles and the power behind environments. So let's get to work: what we're about to learn will pay dividends for us in the future:

  • Where do services come from?
  • Installing an external bundle
  • Configuring bundles
  • Controller outside services
  • Using config:dump-reference
  • Understanding Symfony environments
  • Create your own environment
  • The prod environment and cache:clear
  • The famous parameters.yml
  • Where do routes come from?
  • src/ versus app

Ready, set, go!

Your Guides

Ryan Weaver Leanna Pelham

Buy Access

Questions? Conversation?

  • 2019-05-16 Victor Bocharsky

    Hey Clod!

    Have you tried PhpStorm? Any benefits of using CodeLobster instead of PhpStorm? :) Sure, it's a matter of taste, but PhpStorm is really powerful, and we have a free screencast about it: - I think you can check it and compare ;)


  • 2019-05-15 clod

    My favorite Symfony IDE is Codelobster

  • 2019-02-05 weaverryan

    Hey Chris Moreno!

    Hmm, still pretty relatable, but not entirely, of course. The biggest change would be the directory structure - it's a bit different between Symfony 2.6 and 3. However, all the fundamentals of service configuration, bundle configuration, parameters, environments, etc are all pretty much identical between the versions -I think this would serve you well. And if you have questions, you can always ask us :).


  • 2019-02-03 Chris Moreno

    How relatable is this with Symfony 2.6?

  • 2018-05-28 Diego Aguiar

    Hey heitoralthmann

    You can find the download button inside any chapter of a tutorial. So, just click on any chapter link, and then, at the right upper corner you will see that button :)

    If you have any other troubles, let us know!

  • 2018-05-28 heitoralthmann

    Where can I download the course files?

  • 2017-09-26 Victor Bocharsky

    Hey Wiktor,

    Thanks! That's what we're trying to do ;)

    "Design Pattern" course was a bit postpone because its author was changed. Unfortunately, the previous one have no time to continue working on it. Probably, we'll start releasing it in a few tutorials, see our rough roadmap: . Thanks for your patience.


  • 2017-09-26 Wiktor Liszkiewicz

    Great as always. I really enjoy your tutorials, they make symfony look so easy.
    Ps. When will you releas the "Design Pattern" course ?

  • 2017-07-28 Victor Bocharsky

    Hey Elbarko,

    Thank you! We'll really miss you too! ;)


  • 2017-07-26 Elbarko Lari

    i really enjoyed the first tutorial :p i really want to continu if i had some money for that , any way you are awesome

  • 2017-07-26 Victor Bocharsky

    Hey Sams,

    Could you explain a bit more what you mean about "security context tutorial"? Did you see our Symfony Security tutorial? Is it something you're looking for but for Symfony 2 only?


  • 2017-07-25 Sams Raina

    Hi Team,
    Can you share security context tutorial for symfony 2 ?

  • 2017-06-26 weaverryan

    Thanks Yan Yong!

    That's a cool idea! We'll be updating the courses next year for Symfony 4 - I'll consider doing something like that then - it would be neat!


  • 2017-06-25 Yan Yong

    Thanks Ryan. Your tutorial makes learning symphony quit enjoyable. My suggestion: if you could include a cheatsheet pdf for this course with simple topic that will be very nice.

  • 2017-05-29 Victor Bocharsky

    Great! We're going to add more coding challenges in the future, actually, we want to have coding challenges for all our course, but it need some time to be done.


  • 2017-05-29 Robert Went

    Ah ok, thanks for the clarification!
    I joined yesterday so have access to the code.
    Really enjoying it so far.

  • 2017-05-29 Victor Bocharsky

    Hey Robert,

    Unfortunately, not every course has coding challenges - this course doesn't have them yet. Coding challenges are displayed in course's table of contents, for example, check this one which has coding challenges: .

    But every course has start and finish code, which you can download and open in your IDE if your don't want to code along with the author during the course. On each course chapter page you can find "Download" / "Course code" buttons, however this option available for those users who has paid subscription or own the course.


  • 2017-05-28 Robert Went

    Where do I find the 'coding challenges - practice with real code in an IDE' for each course?

  • 2017-05-22 weaverryan

    Yo Mert Simsek!

    Hmm, I am far from an expert on this. However, I believe that you need to create some sort of connection between Redis and HTTP so that you can create a socket connection in JavaScript. For example: http://haishibai.blogspot.c... or The solution likely won't have anything to do with Symfony or Twig: you'll just render a page in Symfony/Twig, then create some JavaScript that will create be the subscriber. You don't need a subscriber in Symfony: if you want your frontend to be able to update based on published messages, then your frontend (JS) needs to be the subscriber.


  • 2017-05-20 Shairyar Baig

    That's exactly what I am doing now :) features are ready just few tweaks here and there. Cache is good idea I will implement that thanks for the tips.

  • 2017-05-19 Mert Simsek


    I want to get real-time data. Can I do this with redis pub / sub? I own the node.js publisher. I have a symfony subcriber. Can I get the data from node.js and change the twig interface? But i would render twig. How will i send data to twig files?

  • 2017-05-18 Diego Aguiar

    Hey Shairyar Baig

    I would suggest you to first focus on functionality, and then, when you detect a bottleneck, optimize your code / cache a few queries

    Have a nice day!

  • 2017-05-18 Shairyar Baig

    Hi weaverryan many thanks for getting back with your suggestions. I ended up using rendering controller inside twig which worked out fine, its not a heavy traffic site so an addition ping to db wont hurt the performance. Thanks.

  • 2017-05-17 weaverryan

    Hey Shairyar Baig!

    Caching! There are 2 ways to cache in Symfony: (A) via the fairly new Symfony cache component or (B) via HTTP caching. Honestly, we need a tutorial on both of these. I would use Symfony's new cache component. Let me give you a few details:

    A) I don't know what your database setup looks like, but somewhere in your template, you'll need to fetch the image. Create a new Twig function to do this - so something like:

    <img src="{{ get_company_logo() }}"/>

    B) In your Twig extension, you'll be able to make a query to find this path. Symfony 3.1 also comes with a new service whose id is, which you can use to cache the path to the logo. Here are some quick docs about it:

    C) This should be not too hard - just use dependency injection to pass that service to your Twig extension - I know you, so I know you can dig into it ;). But, now what happens when your admin uploads a new logo!? We need to invalidate the cache. Basically, when the user uploads a new image (e.g. you could do this in the controller), you'll need to invalidate the cache you just stored. Details here:

    And of course, I also need to say "Don't prematurely optimize". Having an extra database query is not ideal... but probably doesn't hurt performance much. So, balance that with the added complexity of caching!


  • 2017-05-16 Shairyar Baig

    I was looking for a way to allow the admin of a symfony based app to upload a logo via admin panel and then use that logo on every page, I certainly do not want to ping the database on every route just to get the logo. I cannot seem to find any example on how to achieve this. Any tips :)

  • 2016-12-05 weaverryan

    Ah, thank you!!

  • 2016-12-04 Simon Tran

    Your courses is amazing, thank you it all !

  • 2016-07-09 Paul De Zwaan

    Authors!, symfony is not disappointing me sofar , before have been doing a lot of stuff in Yii, as i have been wanting to try out symfony for a long time, this was really the help that i needed to switch from framework. So big Thanks! Keep up the good work!

  • 2016-05-24 Shairyar Baig

    I am running one of the client's project on shared hosting and its no fun :( i miss having access to CLI to run commands specially when i need to clear cache. It will run without problem but you need to setup .htaccess file in root to point to web folder other wise your every URL will have the word web in it like

  • 2016-05-16 Thierno Diop

    thx a lot

  • 2016-05-07 weaverryan

    For this, you would dump your local database to an SQL file and import it into your host's database manually (through whatever process they allow you - like phpmyadmin). For database changes in the future, you wouldn't be able to use migrations (like we do in this tutorial) - you would need to make those changes manually (though you could copy the SQL statements from the migration files and execute those manually).

    It's not *ideal* to run Symfony without CLI access. It's definitely possible - but as you can see, parts get more complex :)

  • 2016-05-05 dominik

    thanks for the reply.
    how about the initial setup, like doctrine:database:create and such.. is there some way to do it by a script instead of cli?

  • 2016-05-04 weaverryan

    Ah, I understand! Ok:

    1) I'm using the normal "terminal" app in OSX. There are other terminal apps you can download - but this is the normal one that comes with OSX.

    2) For the file and directory coloring, I added the following 2 lines to my ~/.bash_profile file

    export CLICOLOR=1
    export LSCOLORS=GxFxCxDxBxegedabagaced

    Here is the reference I originally used for this: After you make the change, open a new terminal tab to see it.

    3) If you want to change the text that appears at the beginning of each line in your terminal to look like mine, then you can add the following line to your ~/.bash_profile

    export PS1="\w$ "

    After you make this, open a new terminal tab to see it. This changes the text at the beginning of each terminal line from:

    Ryans-MacBook-Pro-4:oo weaverryan$




  • 2016-05-04 Thierno Diop

    thx for the reply i mean the cloring of file and folder and can you be more clear about the export ps1 and how to do it and what you mean by stock"terminal"
    THX you did well with these formations

  • 2016-05-03 weaverryan

    Hi Dominik!

    I don't know of any such tutorial. However, the most important thing is that you:

    A) Upload all of your files (somehow) to the server
    B) Empty the contents of the var/cache directory (app/cache for Symfony 2.x)
    C) Make sure the var/cache and var/logs are writeable by the web server (usually done by 777'ing those directories, but this has - in theory - some security implications).

    This is a non-standard way to use Symfony, but there's no reason that it shouldn't work.

    Good luck!

  • 2016-05-03 dominik

    Hi Ryan, do you know some tutorial for deploying a Symfony app to a shared hosting, where you are not able to run any console commands? Thanks!

  • 2016-05-02 weaverryan

    Hi Theirno!

    Which part - the coloring - or something else? To have a short "prompt" (just the directory at the beginning of each line), I have this code in my ~/.bash_profile file:

    export PS1="\w$ "

    I also - obviously - have made my font size really big - Manaco 22pt. And I *am* using the stock "Terminal" application.

    Does that help? Glad you like it :)


  • 2016-05-01 Thierno Diop

    please can u telle me how did you do to have a terminal like yours in your macbook

  • 2016-03-29 weaverryan

    I haven't used it personally - so sorry, I can't help!

  • 2016-03-29 weaverryan

    Dude, awesome! Welcome :)

  • 2016-03-27 Infete Shine


    Anyone using IvoryCKEditorBundle?

    I just want to know how can I add mathjax plugin to it?


  • 2016-03-23 Constantin

    Hey authors! Thanks for this great learning resource. I am migrating from Laravel to Symfony and the way you structured the course makes it a piece of cake. Thanks!

  • 2016-03-01 Felipe Martins

    WOW! Thanks Ryan & Leanna!