Slide 1

Slide 1 text

Dive Into Symfony 4

Slide 2

Slide 2 text

Kévin Dunglas •Founder of Les-Tilleuls.coop •Symfony Core Team •API Platform Creator @dunglas

Slide 3

Slide 3 text

Les-Tilleuls.coop •Self-managed company since 2011 •100% owned by employees •All benefits are equitably shared between employees •21 people, 97% growth in 2016 •We are hiring! => [email protected]

Slide 4

Slide 4 text

Symfony 4?

Slide 5

Slide 5 text

Roadmap

Slide 6

Slide 6 text

Don’t worry! It’s almost ready… and you can try it now.

Slide 7

Slide 7 text

BC Promise and Upgrade Path •Released at the same time than Symfony 3.4 •SF 3.4 is compatible with SF 3.0:
 BC layer + deprecation notices •SF 4 = SF 3.4, without the BC layer •SF 3.4 is a LTS

Slide 8

Slide 8 text

Symfony Flex

Slide 9

Slide 9 text

Symfony Flex •A new installer for Symfony •It also installs and configures bundles and libs •One goal: improve the overall Symfony DX •It’s a Composer plugin •Designed and developed by Fabien Potencier

Slide 10

Slide 10 text

Create a New Project …

Slide 11

Slide 11 text

Microframework by Default

Slide 12

Slide 12 text

Minimal Deps, PHP 7.1

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

You Want to Use Docker? dunglas/
 symfony-docker-skeleton

Slide 15

Slide 15 text

Simplified Directory Structure ;
 
 No More AppBundle!

Slide 16

Slide 16 text

Microkernel, in src/

Slide 17

Slide 17 text

12-Factor Apps and Env Vars Good bye `parameters.yml`!

Slide 18

Slide 18 text

Cherry-pick what you Need

Slide 19

Slide 19 text

Bundles Autoregistration and Config

Slide 20

Slide 20 text

Appropriate Files
 and Dir are Created
 
 Packages can also be
 Removed

Slide 21

Slide 21 text

It’s Time to Learn Make Again

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Install and Configure Curated Packages •composer req orm => Doctrine ORM •composer req api => API Platform •composer req admin => EasyAdminBundle •composer req jwt-auth => LexikJWTAuthenticationBundle

Slide 24

Slide 24 text

Autowiring

Slide 25

Slide 25 text

0-config: Autowiring Everywhere

Slide 26

Slide 26 text

Symfony 4 and Autowiring •On by default •Service ID = class name •Detects and registers automatically app’s classes as services •Autoconfigures known class (= autowire + add tags)
 ex: event subscriber, validation constraint, twig ext… •Supports named arguments (App\Foo: {$arg: ‘hello’}) •Uses PSR-11

Slide 27

Slide 27 text

Webpack Encore

Slide 28

Slide 28 text

Webpack Encore •A modern and easy way to manage assets •Built on top of Webpack •Babel support (welcome ES200*) •Written in JS •Created by Ryan Weaver

Slide 29

Slide 29 text

Install yarn add
 @symfony/webpack-encore babel-cli babel-preset-env babel-preset-es2017 --dev

Slide 30

Slide 30 text

A Basic Config File (ES2017)

Slide 31

Slide 31 text

The Related Template

Slide 32

Slide 32 text

Questions? Thanks! github.com/dunglas @dunglas