Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Symfony 4 - Let's get dangerous

Marko Kunic
November 08, 2017

Symfony 4 - Let's get dangerous

Symfony 4 is here soon, it is time to get ready, it is time to get dangerous. I tried to cover as much as I could and tried to pick most interesting topics.

Marko Kunic

November 08, 2017
Tweet

More Decks by Marko Kunic

Other Decks in Programming

Transcript

  1. @kunicmarko20 Symfony 4 Let’s get dangerous

  2. @kunicmarko20 Symfony 3.4 - Deprecated features Symfony 4 =

  3. @kunicmarko20 Symfony 3.4 - Deprecated features Symfony 4 = PHP

    ^5.5 PHP ^7.1
  4. @kunicmarko20 Symfony Flex Symfony 4 ≠

  5. @kunicmarko20 Symfony Flex

  6. @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+
  7. @kunicmarko20 Directory Structure

  8. @kunicmarko20 Environment Variables

  9. @kunicmarko20 • Runtime Environment Variables

  10. @kunicmarko20

  11. @kunicmarko20 • Runtime Environment Variables • Deprecated the SYMFONY__ environment

    variables
  12. @kunicmarko20 Before After

  13. @kunicmarko20 • Runtime Environment Variables • Deprecated the SYMFONY__ environment

    variables • Advanced environment variables
  14. @kunicmarko20

  15. @kunicmarko20 • Runtime Environment Variables • Deprecated the SYMFONY__ environment

    variables • Advanced environment variables • Dotenv component • No more --env=prod --no-debug
  16. @kunicmarko20 DI Container Changes

  17. @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
  18. @kunicmarko20

  19. @kunicmarko20

  20. @kunicmarko20

  21. @kunicmarko20

  22. @kunicmarko20 Workflow Component

  23. @kunicmarko20 • Workflow, State Machine • Single/Multiple State • Transitions

    • Transition Events
  24. @kunicmarko20

  25. @kunicmarko20

  26. @kunicmarko20

  27. @kunicmarko20

  28. @kunicmarko20

  29. @kunicmarko20 Transition Events • Guard • Leave • Transition •

    Enter • Entered • Announce • workflow.[event] • workflow.[workflow].[event] • workflow.[workflow].[event].[transition]
  30. @kunicmarko20

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

  32. @kunicmarko20 Want to know more? Knowing your state machines https://www.youtube.com/watch?v=S87111sM7y4

    by Tobias Nyholm @ SymfonyCon Berlin 2016
  33. @kunicmarko20 Cache Component

  34. @kunicmarko20 • PSR-6: Caching Interface

  35. @kunicmarko20

  36. @kunicmarko20 • PSR-6: Caching Interface • PSR-16: Common Interface for

    Caching Libraries
  37. @kunicmarko20

  38. @kunicmarko20 • PSR-6: Caching Interface • PSR-16: Common Interface for

    Caching Libraries • Tag-based invalidation
  39. @kunicmarko20

  40. @kunicmarko20 Let’s implement Cache Component

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

  42. @kunicmarko20

  43. @kunicmarko20

  44. @kunicmarko20

  45. @kunicmarko20

  46. @kunicmarko20

  47. @kunicmarko20

  48. @kunicmarko20

  49. @kunicmarko20 What else has changed?

  50. @kunicmarko20 • User value resolver for controllers

  51. @kunicmarko20 Before

  52. @kunicmarko20 After

  53. @kunicmarko20 • User value resolver for controllers • PHP constants

    in YAML files
  54. @kunicmarko20

  55. @kunicmarko20 • User value resolver for controllers • PHP constants

    in YAML files • Project root directory parameter
  56. @kunicmarko20 %kernel.root_dir%/../web/

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

  58. @kunicmarko20 %kernel.project_dir%/web/

  59. @kunicmarko20 • User value resolver for controllers • PHP constants

    in YAML files • Project root directory parameter • Asset preloading with HTTP/2 Push
  60. @kunicmarko20 Read more: https://dunglas.fr/2017/10/symfony-4-http2-push-and-preloading

  61. @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
  62. @kunicmarko20

  63. @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
  64. @kunicmarko20

  65. @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
  66. @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
  67. @kunicmarko20

  68. @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
  69. @kunicmarko20 Before After

  70. @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
  71. @kunicmarko20

  72. @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
  73. @kunicmarko20

  74. @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
  75. @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
  76. @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
  77. @kunicmarko20 The End