What's new with Symfony 3
We waited so long but now Symfony 3 is here! It's really amazing and we have a lot of new features and documentation to read. There is no time to waste. Let's see all news.
Finally we have an amazing blog application where we can see how an application is built with CRUD operations, Doctrine, multi-language and all basic operations we need to see and reuse with Symfony. First of all we need to execute the new symfony command from our CLI and operative system. If you are using Linux like me just run these commands:
sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
sudo chmod a+x /usr/local/bin/symfony
Just type symfony to verify all is ok and now you are ready to install the blog application. You can update the executable file with symfony self-update like you do with composer.
The application uses SQLite so you will need the driver or you will have an error on the public section. If you don't have the driver, you can install it and restart Apache:
sudo apt-get install php5-sqlite
sudo /etc/init.d/apache2 restart
Now all must be ok. The application do not run with the symfony web server, so I have a link like this on my browser: http://localhost/symfony_demo/web/app_dev.php/en. You can check the app requirements with the CLI:
New DependencyInjection features
A MicroKernel to create your own micro framework based on Symfony
Improvements and new features for the...
- Console component
- Yaml component
- Form component
- Translator component
- VarDumper component
- Security component
Do you think passing from Symfony 2 to 3 can be hard and actually you will never do it? Actually it's not so hard. First, make your application run on Symfony 2.8 without errors. Then, install the PHPUnitBridge component and fix all the reported deprecation issues. Now you are ready to upgrade to Symfony 3.0. You can also use any of these tools to spot and fix those deprecations:
Other differences from Symfony 2
- The console file has been moved from app to the bind directory
- Testing: now you run simply phpunit instead of phpunit -c app
- app/logs and app/cache directories are now on var/logs and var/cache with the var/session.
- Many files were moved. We can use dependency injection with bundles but they are not generated automatically anymore. We are encouraged to use routes annotations instead of yml or xml files. I liked using yml files but annotations are good too. Maybe they are less comfortable when you have to specify requirements, URL parameters, HTTP method and many others options.