Symfony 3 is a major version update of Symfony. This means that code working on Symfony 2 applications might not work on Symfony 3. In order to update your bundles for Symfony 3, you need to make sure that your bundle doesn't use any of the removed features without also using the replacement. This guide will teach you how to add Symfony 3 support to your bundle and it'll also give you some practical tips to support both Symfony 2 and 3.
As bundles are created for the Symfony framework, they almost always have some
sort of dependency on a Symfony package (symfony/framework-bundle being the
most commonly used dependency). The version constraints used for these packages
should be updated to allow installing the bundle with Symfony 3. For instance,
if your composer.json file contains something like this:
{
"require": {
"symfony/framework-bundle": "~2.3",
"...": "..."
}
}Update it to something like this:
{
"require": {
"symfony/framework-bundle": "~2.3|~3.0",
"...": "..."
}
}The new version constraint means that the bundle requires the
symfony/framework-bundle package with a version that's either ~2.3 or
~3.0.
composer require symfony/symfony "3.0.*@beta"- (optionally) Use branch aliases
composer require symfony/symfony "3.0.*@beta as 2.8.x-dev" - Run tests
Tip
Use symfony/phpunit-bridge on Symfony 2.8 tests to find many deprecated
features.
symfony new sf3-testing 3.0- Requiring the bundle
- (optionally) Use branch aliases
3.0.*@beta as 2.8.x-dev