Symfony Montréal
Presented by
Welcome
Michaël Villeneuve
CTO @ ctrlweb
/michael.villeneuve.18
1 year
8 meetups in 2016 every 6 weeks
- Docker et Symfony (16/11/2015)
- Symfony 3.0 (25/01/2016)
- TDD & BDD with Symfony - Steven Rosato (mid-March)
- API with FOSRestBundle
- Create a CMS with SonataAdminBundle
- How to optimise Doctrine
- Symfony caching system
- SyliusBundle
Before we start...
17h30 - 19h00 Networking
19h00 - 20h00
After... Pub victoria
Before we start...
Before we start...
- Benjamin Gonzalez
- Jobs
- Sponsors
- Futur
Today
Objectives
- Ugh... A major version! Should I worry?
- What's new?
- Backward compatibility issues?
Horaire
19h00 Introduction
19h05 Should I worry
19h10 What's new
19h20 Backward compatibility issues
19h30 Examples
19h45 Gruppio
Should I worry?
I realise that talking about Symfony 3 makes people nervous and this post is going to explain the Symfony 3 strategy and the reasons why you should not panic [...]
As the project manager of Symfony, one of my responsibility is it to keep the code as stable as possible for as long as possible
Fabien Potencier
CEO, Blackfire.io
What's new?
Well, as Fabien told us...
...not much!
But... what's new?
- Stricter quality process
- Process to remove legacy code
- New directory structure
Stricter quality process
SensioLabs DeprecationDetector
Easy to install
$ git clone git@github.com:sensiolabs-de/deprecation-detector.git
$ composer install
$ box build
$ sudo chmod a+x deprecation-detector.phar
$ sudo mv deprecation-detector.phar /usr/local/bin/deprecation-detector
$ deprecation-detector check src/ --log-html log.html
Easy to use
New directory structure
|#The application configuration, templates and translations.
|--app/
|
|#Executable files (e.g. bin/console).
|--bin/
|
|#The project's PHP code.
|--src/
|
|#Automatic tests (e.g. Unit tests).
|--tests/
|
|#Generated files (cache, logs, etc.).
|--var/
|
|#The third-party dependencies.
|--vendor/
|
|#The web root directory.
|--web/
Benefits of the Symfony 3 directory structure
- All binary executables are under /bin
- The new /var contains the files to which the system writes data
- phpunit can be run from the project root without having to explicitly specify the path of the configuration file.
Why 3.0?
- Break backward Compatibility
- Remove obsolete features
- Fix architecture
- Take into account the ecosystem
- PHP's new capabilities
- best practice changes
- new web paradigms
Backward compatibility
http://symfony.com/bc
Semantic Versioning means that only major releases (such as 2.0, 3.0 etc.) are allowed to break backwards compatibility
Upgrading to 3.0
It's a 3 step process
- Adapt your directory structure (optional)
- Use the DeprecationDetector & the upgrade guide to clean up deprecations
- Upgrade dependencies (symfony/symfony: "3.0.*" & php version)
Example #1: ProgressHelper
$h = new ProgressHelper();
$h->start($output, 10);
for ($i = 1; $i < 5; $i++) {
usleep(200000);
$h->advance();
}
$h->finish();
Example #2: Table Helper
$table = $app->getHelperSet()->get('table');
$table
->setHeaders(array('ISBN', 'Title', 'Author'))
->setRows(array(
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
))
;
$table->render($output);
The DeprecationDetector is nice... but not enough
Upgrade!
"require": {
// "php": ">=5.3.9",
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
// ...
},
// ...
"config": {
"bin-dir": "bin",
"platform": {
//"php": "5.3.9"
"php": "5.5.9"
}
},
$ composer update --with-dependencies
Gruppio
Symfony 3.0.0 01/02/2016
By michael-villeneuve