Search code examples
phpsymfonysymfony-2.3symfony-4.4

Upgrading Symfony 2.3 to 4.4


How time consuming is migrating a medium/large sized legacy Symfony application from version 2.3 to 4.4 compared to rewriting it in a different framework?

From the research I've done it seems like quite a lot of stuff has changed between these versions so I'm trying to weigh this decision up against just rewriting the whole thing in Laravel (the framework I'm experienced in). I'm trying not to get stuck in a wormhole of rewriting abandoned code.

The main reason for the upgrade is security fixes, running Symfony 2.3 in 2021 doesn't seem like the best idea to me. The codebase won't need any changes in the near future.

Following is an overview of used packages. composer outdated --direct


Solution

  • Upgading you symfony version that much means 3 steps:

    • upgrading your php version (PHP 5.3.3 to 7.1.3)
    • upgrading your package (most of them will not work any more or have lot of changes)
    • upgrading symfony

    It mostly depends of your code coverage: if you have a good code coverage, you will be able to quickly identify remainings bug

    otherwise it depends on your legacy:

    1. are best practice used?
    2. is the code clear?
    3. is the code well decomposed?

    For larger project, i don't recommand to create a new one: it cost a lot of money and may prouce bugs and regression

    The best way to do it is step by step. Determine which package to upgrade one by one, do it and push it in production with the apropriate code coverage.

    Start with your php version: on local, have your devellopement be run in higher php version to identify most bugs and correct them

    Manage each of your abandonned project to replace them with the recommended one

    • we had to deal with phpexcel to php spreadsheet. We identify each place where it was used in the application, and update each of them, one by one (having both package on project). When phpexcel wasn't used anymore, we deleted it