symfony - Symfony2 LTS: how to upgrade from 2.3 to 2.7? -
symfony 2.7 released on 30th april 2015 , current lts (long term support) version after 2.3 version. maintenance these versions end on may 2016 symfony 2.3 , may 2018 symfony 2.7. security fixes released during 1 year after end of maintenance both versions.
as suggested massimiliano arione in announce comments, changes required upgrade symfony 2.3 2.7 without having check minor upgrades (2.3 → 2.4, 2.4 → 2.5, etc.)?
as reminded med in comment, symfony2 developers have tried keep backward compatibility in 2.x
branch. long don't want switch 3.0
branch later, can ignore changes between 2.3 , 2.7 because deprecation changes.
in order upgrade app symfony 2.3 symfony 2.7 you'll have update composer.json file:
([…]
indicates unchanged code)
old (2.3) version:
{ […] "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.3.*", "doctrine/orm": "~2.2,>=2.2.3,<2.5", "doctrine/dbal": "<2.5", "doctrine/doctrine-bundle": "~1.2", "twig/extensions": "1.0.*", "symfony/assetic-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.4", "sensio/distribution-bundle": "~2.3", "sensio/framework-extra-bundle": "~3.0,>=3.0.2", "sensio/generator-bundle": "~2.3", "incenteev/composer-parameter-handler": "~2.0" }, "scripts": { "post-install-cmd": [ "incenteev\\parameterhandler\\scripthandler::buildparameters", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::buildbootstrap", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::clearcache", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installassets", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installrequirementsfile", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::preparedeploymenttarget" ], "post-update-cmd": [ "incenteev\\parameterhandler\\scripthandler::buildparameters", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::buildbootstrap", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::clearcache", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installassets", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installrequirementsfile", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::preparedeploymenttarget" ] }, […] "minimum-stability": "stable", "extra": { […] "incenteev-parameters": { "file": "app/config/parameters.yml" }, "branch-alias": { "dev-master": "2.3-dev" } } }
new (2.7) version:
{ […] "autoload": { "psr-4": { "": "src/", "symfonystandard\\": "app/symfonystandard/" } }, "require": { "php": ">=5.3.9", "symfony/symfony": "2.7.*", "doctrine/orm": "^2.4.8", "doctrine/doctrine-bundle": "~1.4", "symfony/assetic-bundle": "~2.3", "symfony/swiftmailer-bundle": "~2.3", "symfony/monolog-bundle": "~2.4", "sensio/distribution-bundle": "~4.0", "sensio/framework-extra-bundle": "^3.0.2", "incenteev/composer-parameter-handler": "~2.0" }, "require-dev": { "sensio/generator-bundle": "~2.3", "symfony/phpunit-bridge": "~2.7" }, "scripts": { "post-install-cmd": [ "incenteev\\parameterhandler\\scripthandler::buildparameters", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::buildbootstrap", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::clearcache", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installassets", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installrequirementsfile", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::removesymfonystandardfiles", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::preparedeploymenttarget" ], "post-update-cmd": [ "incenteev\\parameterhandler\\scripthandler::buildparameters", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::buildbootstrap", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::clearcache", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installassets", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installrequirementsfile", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::removesymfonystandardfiles", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::preparedeploymenttarget" ] }, […] "extra": { […] "symfony-assets-install": "relative", […] "branch-alias": { "dev-master": "2.7-dev" } } }
summary:
- symfony version updated
psr-4
used instead ofpsr-0
twig/extensions
not installed default, may need add if use twig extensionssensio/generator-bundle
required indev
environmentscripts
part has been updated"minimum-stability": "stable",
has been removed
once have updated composer.json file, have update dependencies:
composer update --prefer-dist -vv
then may need flush cache:
php app/console cache:clear --env=dev
note: used following command in order composer.json files:
# create symfony "2.3.*" project in "2.3" directory composer create-project symfony/framework-standard-edition "2.3" "2.3.*" --no-interaction -v # create symfony "2.7.*" project in "2.7" directory composer create-project symfony/framework-standard-edition "2.7" "2.7.*" --no-interaction -v # compare symfony 2.3 , 2.7 composer.json files diff -u 2.3/composer.json 2.7/composer.json
(we use 2.3.*
, not 2.3
because want last version (2.3.31
today) , not initial release (2.3.0
))
the diff available @ github too, composer.json file of symfony 2.3 has been updated multiple times, may different file.
Comments
Post a Comment