How to Upgrade to Symfony 2.8

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.

Confused by the First Paragraph?

The Symfony Demo: example app: a project barely alive... on Symfony 2.7. Ladies and gentlemen, we can rebuild it, we have the technology. We have the capability to make the world's first Symfony 3 app. Better than it was before, stronger, faster, the 3.0 version demo app. This series is all about upgrading to Symfony 3.

Of course, the first step is actually to upgrade to Symfony 2.8. No wait! That's really cool too: because it'll give us all of the features of Symfony 3.

To get to 2.8, open the composer.json file, find the symfony/symfony line and set it to 2.8. At recording, Symfony 2.8 wasn't released yet so I'll set this to 2.8.*@BETA:

62 lines composer.json
... lines 1 - 8
"require": {
... lines 10 - 26
"symfony/symfony" : "2.8.*@BETA",
... line 28
... lines 30 - 62

But you - person-living-in-the-future - you should set it to 2.8.*.

Head over to the terminal and run:

composer update symfony/symfony --with-dependencies

This will download 2.8 and update any other libraries that Symfony depends on.

Yes yes, I realize that we're ignoring potential updates of all of these other bundles and libraries. But focus! Upgrade Symfony first, and then upgrade other libraries when you want to.

Changes in 2.8 (Deprecations)

Since we're just upgrading from Symfony 2.7 to 2.8, there shouldn't be any backwards compatibility breaks... though one usually sneaks in... usually with forms. While Composer is dialing out to Jordi, switch to the browser, and head to to check out the upgrade log for 2.8 to see what has changed.

This describes things that were deprecated. Translation: these are things you'll need to upgrade before heading to 3.0... but you can safely ignore them for now. I've already covered some of these in our tutorial on What's new in Symfony 3. For example, the new way you create form types has changed quite a lot. But this isn't our concern quite yet.

Head back to the terminal to check on our update. Cool it's done! Scroll up to see that it updated to Symfony 2.8 Beta 1, and grabbed a whole bunch of other library updates related to this.

Go over to the browser and refresh our localhost homepage. That's it! We've now got the new web debug toolbar at the bottom: ooo pretty. That's your sign that you are now upgraded to 2.8!

That is the easiest step in this process... and it's also the most important because Symfony 2.8 has all the features of 3.0. So yea, woo! Next we'll upgrade to the new, fancy, Symfony 3 directory structure.

Leave a comment!

  • 2019-05-31 Diego Aguiar

    Hey Chris Moreno

    I left you some questions in your other thread

  • 2019-05-30 Chris Moreno

    I was able to move from that error, but i am not getting this.

    symfony FatalThrowableError in app_dev.php line 25:

  • 2019-05-28 Vladimir Sadicov

    Hey Chris Moreno

    Sorry for late answer, could you please provide more info, like output of php -v
    And check for loaded extension, probably there is some php misconfiguration.


  • 2019-05-22 Chris Moreno

    I am currently using php 7.1 and I don’t think I have enable opcache extension

  • 2019-05-22 Vladimir Sadicov

    Hi Chris Moreno

    Which php version do you use and have you enabled opcache extension?


  • 2019-05-21 Chris Moreno


    I am getting this first error. I am trying to update my current symfony app 2.6 to 2.8 (dont judge me! lol)

    > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
    Cannot load Zend OPcache - it was already loaded

  • 2019-02-14 weaverryan

    Hey Skylar Scotlynn Gutman!

    Fascinating! I've never heard of this - I think you stumbled upon an edge case in Symfony's config system that probably doesn't quite work as well as it should. Here's an issue about it:

    So basically, this *usually* works - the keys are all merged together just fine. The difference is that, for *most* of the config keys, there is a Configuration file that determines literally every valid key that is allowed - However, this ssl key is a bit special - you're allowed to pass *any* array with *any* keys you want - - and when you have THAT situation... apparently the arrays cannot be merged unless they all have the same keys. I know - super weird.

    So, *ideally* you can work around it by, for example, setting `cafile: null` or something similar in your main config.yml... but that could have side effects. If you can't find a work around - let me know - there is *always* a work around ;).


  • 2019-02-13 Skylar Scotlynn Gutman

    So I found the culprit. For swiftmailer my config.yml has this:

    # Swiftmailer Configuration
    transport: "%mailer_transport%"
    host: "%mailer_host%"
    username: "%mailer_user%"
    password: "%mailer_password%"
    auth_mode: "%mailer_auth_mode%"
    port: "%mailer_port%"
    encryption: "%mailer_encryption%"
    # spool: { type: memory }
    logging: true
    allow_self_signed: true
    verify_peer: false
    verify_peer_name: false

    but my config_dev.yml has this:

    spool: { type: memory }
    allow_self_signed: true
    verify_peer: false
    verify_peer_name: false
    cafile: "C:\\php7\\cacert.pem"

    Notice the extra line for the "cafile" that is not in the config.yml.

    Why should this make a difference?

  • 2019-02-13 Skylar Scotlynn Gutman

    Hello, After the update, Cache:clear fails with [RuntimeException] merge() expects a normalized config array. I am assuming it means that it does not like a config file. How do I find out which one?

  • 2017-10-23 Diego Aguiar

    Hmm, interesting, which version of `doctrine-bundle` are you using? Try using 1.6
    And make sure you are really running in PHP 7.1, that error is related to PHP 7.0


  • 2017-10-20 RAJAONA Ywoumé

    i have this error then i upgrade to symfony 2.8 when i do : composer update symfony/symfony --with-dependencies , when the vendor is installed i have this error when i refresh my broswer

  • 2017-10-20 Diego Aguiar

    Hey RAJAONA Ywoumé

    Could you tell us more information about that error.
    What were you doing when it ocurred?


  • 2017-10-20 RAJAONA Ywoumé

    Fatal error: Uncaught TypeError: Return value of Doctrine\Common\Annotations\AnnotationRegistry::registerLoader() must be an instance of Doctrine\Common\Annotations\void, none returned in /home/ywoume/www/upgrade/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationRegistry.php on line 117

    i use php7.1