Академический Документы
Профессиональный Документы
Культура Документы
@fabpot
Have you ever
used Symfony?
1.x? 2.x? 3.x? 4.x?
What is Symfony 4?
A new developer experience
On a rock solid foundation
From micro-style to monolith
4
in action…
5
$ symfony new demo
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
Demo
$ tree -I vendor
Only 16 files
vs 31 SE
$ find . -type f | wc -l
3300 total
vs 8867 SE
-65%
New directory structure
• Less depth, easier to navigate
https://github.com/symfony/recipes-contrib
370+ recipes
Demo
$ composer show | wc -l
Only 25 deps
vs 38 + 50 = 88 SE
Symfony 2+/3+
42 components Ldap Routing 4 bridges 11 bundles
Asset Dotenv OptionsResolver Security Doctrine Bridge Debug Bundle WebServer Bundle
Cache ExpressionLanguage Polyfill Intl ICU Stopwatch PHPUnit Bridge Framework Bundle
Console Form Polyfill PHP 7.0 Validator Doctrine (11) Monolog Bundle
EventDispatcher
HttpFoundation Flex
Debug HttpKernel
DependencyInjection
Yaml
Demo
$ symfony server:start -d
$ symfony server:log
Demo
Demo
$ ./bin/console
15 commands
vs 57 SE
Demo
$ git init
$ git add .
$ git commit -a -m"init"
Demo
$ ./bin/console make:controller
Symfony Maker Bundle
$ vim src/Controller/DefaultController.php
Which interface/class
do I need to implement/ Which tag do I need
extend? It’s too complex. What
to use? about doing it the dirty
way and do it in the
controller instead?
$ ./bin/console make:twig-extension
DONE!
Full Automation works for…
• Twig extensions
• Event listeners
• Doctrine repositories
• Commands
• Voters
•…
Beyond “Hello World”
• Defining some models via Doctrine
<spacer size="16"></spacer>
<h1 class="text-center">Forgot Your Password?</h1>
<spacer size="16"></spacer>
<p class="text-center">It happens. Click the link below to reset it.</p>
<button class="large expand" href="#">Reset Password</button>
<hr/>
framework:
messenger:
transports:
email: "doctrine://default"
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: email
$ ./bin/console messenger:consume
I want to send rich and responsive emails
from my controller
via my provider's API
asynchronously with AMQP
Symfony Maker Bundle
framework:
messenger:
transports:
email: "amqp://guest:guest@localhost:5672/%2f/messages"
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: email
$ ./bin/console messenger:consume
Symfony 4 recap
• Auto-configuration for any Composer package
https://api-platform.com/
The most advanced e-commerce solution
Many admin-gen solutions
https://github.com/EasyCorp/EasyAdminBundle
The foundation of the PHP ecosystem
Truly independent components
https://symfony.com/releases
Predictable releases and support
Release +8 months +14 months +36 months +48 months
Standard Releases
(3.3, 4.0)
end of end of security
support support
LTS Releases
(2.8, 3.4)
Predictable releases and support
3.4
LTS
4.2
Stable
https://symfony.com/releases
Stability and predictability
• Strict semantic versioning
• Deprecation/BC policy
• Responsible security issue management
https://symfony.com/bc
https://symfony.com/security
The fastest framework around
x2
x3
x4
http://www.phpbenchmarks.com/
Scale from micro to monolith
start with
13 files
… and grow as you see fit
via automation
15 dependencies
Community oriented
• Code of conduct
https://symfony.com/conduct
Diversity initiative
https://symfony.com/diversity
https://symfony.com/4
Thank you!