Symfony Fundamentals: Bundles, Configuration & Environments

After the first course - Joyful Development with Symfony, 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

Questions? Conversation?

  • 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 http://example.com/web

  • 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: http://osxdaily.com/2012/02/21.... 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$

    to

    ~/path/to/current/directory$

    Cheers!

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

    Cheers!

  • 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

    Hi

    Anyone using IvoryCKEditorBundle?

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

    Thanks

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

  • 2016-02-29 Michal Jarnot

    yay :)