Slide 1

Slide 1 text

@kunicmarko20 Symfony 4 Let’s get dangerous

Slide 2

Slide 2 text

@kunicmarko20 Symfony 3.4 - Deprecated features Symfony 4 =

Slide 3

Slide 3 text

@kunicmarko20 Symfony 3.4 - Deprecated features Symfony 4 = PHP ^5.5 PHP ^7.1

Slide 4

Slide 4 text

@kunicmarko20 Symfony Flex Symfony 4 ≠

Slide 5

Slide 5 text

@kunicmarko20 Symfony Flex

Slide 6

Slide 6 text

@kunicmarko20 ● Composer plugin ● Replaces Symfony Standard Edition ● Compose your Application ● Recipes (Official, Contrib) ● Depend on the individual Symfony Components ● Bundle-less Application ● New Directory structure ● Environment Variables ● Unified Web Front Controller ● Defining compiler passes in the kernel ● Symfony 3.3+

Slide 7

Slide 7 text

@kunicmarko20 Directory Structure

Slide 8

Slide 8 text

@kunicmarko20 Environment Variables

Slide 9

Slide 9 text

@kunicmarko20 ● Runtime Environment Variables

Slide 10

Slide 10 text

@kunicmarko20

Slide 11

Slide 11 text

@kunicmarko20 ● Runtime Environment Variables ● Deprecated the SYMFONY__ environment variables

Slide 12

Slide 12 text

@kunicmarko20 Before After

Slide 13

Slide 13 text

@kunicmarko20 ● Runtime Environment Variables ● Deprecated the SYMFONY__ environment variables ● Advanced environment variables

Slide 14

Slide 14 text

@kunicmarko20

Slide 15

Slide 15 text

@kunicmarko20 ● Runtime Environment Variables ● Deprecated the SYMFONY__ environment variables ● Advanced environment variables ● Dotenv component ● No more --env=prod --no-debug

Slide 16

Slide 16 text

@kunicmarko20 DI Container Changes

Slide 17

Slide 17 text

@kunicmarko20 ● Services are Loaded Automatically ● Type-hint instead of Service id ● Controllers are Registered as Services ● Auto-tagging with autoconfigure ● Services private by Default ● Named args ● Local service binding

Slide 18

Slide 18 text

@kunicmarko20

Slide 19

Slide 19 text

@kunicmarko20

Slide 20

Slide 20 text

@kunicmarko20

Slide 21

Slide 21 text

@kunicmarko20

Slide 22

Slide 22 text

@kunicmarko20 Workflow Component

Slide 23

Slide 23 text

@kunicmarko20 ● Workflow, State Machine ● Single/Multiple State ● Transitions ● Transition Events

Slide 24

Slide 24 text

@kunicmarko20

Slide 25

Slide 25 text

@kunicmarko20

Slide 26

Slide 26 text

@kunicmarko20

Slide 27

Slide 27 text

@kunicmarko20

Slide 28

Slide 28 text

@kunicmarko20

Slide 29

Slide 29 text

@kunicmarko20 Transition Events ● Guard ● Leave ● Transition ● Enter ● Entered ● Announce ● workflow.[event] ● workflow.[workflow].[event] ● workflow.[workflow].[event].[transition]

Slide 30

Slide 30 text

@kunicmarko20

Slide 31

Slide 31 text

@kunicmarko20 http://symfony-workflow-demo.herokuapp.com

Slide 32

Slide 32 text

@kunicmarko20 Want to know more? Knowing your state machines https://www.youtube.com/watch?v=S87111sM7y4 by Tobias Nyholm @ SymfonyCon Berlin 2016

Slide 33

Slide 33 text

@kunicmarko20 Cache Component

Slide 34

Slide 34 text

@kunicmarko20 ● PSR-6: Caching Interface

Slide 35

Slide 35 text

@kunicmarko20

Slide 36

Slide 36 text

@kunicmarko20 ● PSR-6: Caching Interface ● PSR-16: Common Interface for Caching Libraries

Slide 37

Slide 37 text

@kunicmarko20

Slide 38

Slide 38 text

@kunicmarko20 ● PSR-6: Caching Interface ● PSR-16: Common Interface for Caching Libraries ● Tag-based invalidation

Slide 39

Slide 39 text

@kunicmarko20

Slide 40

Slide 40 text

@kunicmarko20 Let’s implement Cache Component

Slide 41

Slide 41 text

@kunicmarko20 composer require snc/redis-bundle predis/predis

Slide 42

Slide 42 text

@kunicmarko20

Slide 43

Slide 43 text

@kunicmarko20

Slide 44

Slide 44 text

@kunicmarko20

Slide 45

Slide 45 text

@kunicmarko20

Slide 46

Slide 46 text

@kunicmarko20

Slide 47

Slide 47 text

@kunicmarko20

Slide 48

Slide 48 text

@kunicmarko20

Slide 49

Slide 49 text

@kunicmarko20 What else has changed?

Slide 50

Slide 50 text

@kunicmarko20 ● User value resolver for controllers

Slide 51

Slide 51 text

@kunicmarko20 Before

Slide 52

Slide 52 text

@kunicmarko20 After

Slide 53

Slide 53 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files

Slide 54

Slide 54 text

@kunicmarko20

Slide 55

Slide 55 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter

Slide 56

Slide 56 text

@kunicmarko20 %kernel.root_dir%/../web/

Slide 57

Slide 57 text

@kunicmarko20 %kernel.root_dir%/../web/

Slide 58

Slide 58 text

@kunicmarko20 %kernel.project_dir%/web/

Slide 59

Slide 59 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push

Slide 60

Slide 60 text

@kunicmarko20 Read more: https://dunglas.fr/2017/10/symfony-4-http2-push-and-preloading

Slide 61

Slide 61 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns

Slide 62

Slide 62 text

@kunicmarko20

Slide 63

Slide 63 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock Component

Slide 64

Slide 64 text

@kunicmarko20

Slide 65

Slide 65 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance

Slide 66

Slide 66 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates

Slide 67

Slide 67 text

@kunicmarko20

Slide 68

Slide 68 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates ● Better console exceptions

Slide 69

Slide 69 text

@kunicmarko20 Before After

Slide 70

Slide 70 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates ● Better console exceptions ● Lazy commands

Slide 71

Slide 71 text

@kunicmarko20

Slide 72

Slide 72 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates ● Better console exceptions ● Lazy commands ● Improved comparison constraints

Slide 73

Slide 73 text

@kunicmarko20

Slide 74

Slide 74 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates ● Better console exceptions ● Lazy commands ● Improved comparison constraints ● Groups support for the Valid constraint

Slide 75

Slide 75 text

@kunicmarko20 ● User value resolver for controllers ● PHP constants in YAML files ● Project root directory parameter ● Asset preloading with HTTP/2 Push ● Import config files with glob patterns ● Lock component ● Deprecated bundle inheritance ● Improved the overriding of templates ● Better console exceptions ● Lazy commands ● Improved comparison constraints ● Groups support for the Valid constraint ● Argon2i password hasher

Slide 76

Slide 76 text

@kunicmarko20 Similar Talks ● Symfony 4 & Symfony Flex - Core ideas, features and improvements by Victoria Quirante ● Symfony 4 Run-through by Kévin Dunglas ● Get ready for Symfony 4 by Christian Flothmann ● Getting ready for Symfony 4 by Denis Brumann

Slide 77

Slide 77 text

@kunicmarko20 The End