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

Cartographing Symfony

Cartographing Symfony

This talk takes a look at Symfony Components from a package design perspective. We first categorize the components in functional layers and then take a closer look at how those layers are used by analyzing the package dependents. From there we take a look at package design principles and how they affect both the packages itself and their documentation and finally we discuss common questions around Symfony components.

Denis Brumann

February 04, 2021
Tweet

More Decks by Denis Brumann

Other Decks in Programming

Transcript

  1. Cartographing Symfony
    Making sense of the Symfony Components when used
    standalone or in full-stack

    View full-size slide

  2. Symfony 2.0
    Full List of Components
    BrowserKit

    ClassLoader

    Config

    Console

    CssSelector

    DependencyInjection

    DomCrawler

    EventDispatcher

    Filesystem

    Finder

    Form

    HttpFoundation

    HttpKernel

    Locale

    Process

    Routing

    Security

    Serializer

    Templating

    Translation

    Validator

    Yaml
    22 components

    View full-size slide

  3. Symfony 5.2
    Full List of Components
    Asset

    BrowserKit

    Cache

    Config

    Console

    CssSelector

    DependencyInjection

    DomCrawler

    Dotenv

    ErrorHandler

    EventDispatcher

    ExpressionLanguage

    Filesystem

    Finder

    Form

    HttpClient

    HttpFoundation

    HttpKernel

    Inflector

    Intl

    Ldap

    Lock

    Mailer

    Messenger

    Mime

    Notifier

    OptionsResolver

    Process

    PropertyAccess

    PropertyInfo

    RateLimiter

    Routing

    Security

    Semaphore

    Serializer

    Stopwatch

    String

    Templating

    Translation

    Uid

    Validator

    VarDumper

    VarExporter

    WebLink

    Workflow

    Yaml

    26 NEW components

    *compared to Symfony 2.0

    View full-size slide

  4. core features utility features
    application features framework features

    View full-size slide

  5. 74.336
    Dependents Overall

    View full-size slide

  6. Core Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Workflow
    VarDumper
    Uid
    Validator
    Yaml

    View full-size slide

  7. Core Features
    Improve on core PHP functionality

    • HttpFoundation provides OOP on top of superglobals

    • String provides clear API around mb_* and other string functions

    • Uid provides OOP for handling UUID/ULID-strings

    • VarExport works around limitations of clone

    • …

    View full-size slide

  8. Core Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Workflow
    VarDumper
    Uid
    Validator
    Yaml

    View full-size slide

  9. Core Features
    Filesystem

    View full-size slide

  10. 12.187
    Dependents on Core Features

    View full-size slide

  11. Utility Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Workflow
    VarDumper
    Uid
    Validator
    Yaml

    View full-size slide

  12. Utility Features
    Components that can be used outside of Symfony, e.g. in libraries

    • Process

    • Finder

    • EventDispatcher

    View full-size slide

  13. Utility Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  14. Utility Features
    Finder

    View full-size slide

  15. Utility Features
    Finder

    View full-size slide

  16. 37.240
    Dependents on Utility Features

    View full-size slide

  17. Application Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  18. Application Features
    Application components, that usually work on top of the framework, core or
    utility features

    • Messenger supports Mailer optionally uses Serializer

    • Form relies on Validation (optionally), HttpFoundation and OptionResolver

    View full-size slide

  19. Application Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  20. Application Features
    Messenger

    View full-size slide

  21. 9.627
    Dependents on Application Features

    View full-size slide

  22. Framework Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  23. Framework Features
    Components that primarily build up Symfony as an application framework

    • HttpKernel ties config, routing, error handling for web app together

    • Config loads human processable config files and validates them

    • DependencyInjection takes config and creates PHP service configuration

    • Routing provides a way to determine which Controller should be used

    • ErrorHandler centralizes & streamlines error-/exception-handling

    • Templating renders output for Response

    View full-size slide

  24. Framework Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  25. Framework Features
    DependencyInjection

    View full-size slide

  26. 15.282
    Dependents on Framework Features
    *
    * Symfony Bundles

    View full-size slide

  27. Framework Features
    Asset
    BrowserKit
    Cache
    Config
    CssSelector
    DependencyInjection
    DomCrawler
    Console
    ErrorHandler
    EventDispatcher
    ExpressionLanguage
    Filesystem
    DotEnv
    Form
    HttpClient
    HttpFoundation
    Inflector
    Intl
    Ldap
    HttpKernel
    Mailer
    Messenger
    Mime
    Notifier
    Lock
    Finder
    Process
    PropertyAccess
    PropertyInfo
    Routing
    Security
    Semaphore
    RateLimiter
    Stopwatch
    String
    Templating
    Translation
    Serializer
    OptionsResolver
    VarExporter
    Weblink
    Yaml
    VarDumper
    Uid
    Validator
    Workflow

    View full-size slide

  28. core

    features
    utility

    features
    application

    features
    framework

    features
    less coupled more coupled

    View full-size slide

  29. core

    features
    utility

    features
    easier to use harder to use
    application

    features
    framework

    features

    View full-size slide

  30. core

    features
    utility

    features
    easier to use standalone harder to use standalone
    application

    features
    framework

    features

    View full-size slide

  31. Symfony 2.8
    • Assets

    • ExpressionLanguage

    • Intl

    • Ldap

    • OptionsResolver

    • PropertyInfo

    View full-size slide

  32. Symfony 3.4
    • Cache

    • DotEnv

    • Inflector

    • WebLink

    • Workflow

    View full-size slide

  33. Symfony 4.4
    • ErrorHandler

    • HttpClient

    • Messenger

    • Mime

    • Notifier

    • VarExporter

    View full-size slide

  34. Symfony 5.2
    • RateLimiter

    • Semaphore

    • String

    • Uid

    View full-size slide

  35. https://matthiasnoback.nl/book/principles-of-package-design/

    View full-size slide

  36. The Release/Reuse Equivalence Principle
    The Common Reuse Principle
    The Common Closure Principle
    The Acyclic Dependencies Principle
    The Stable Dependencies Principle
    The Stable Abstractions Principle

    View full-size slide

  37. ISO/IEC 25010

    View full-size slide

  38. Decoupled?!
    Using Symfony Components standalone is really difficult!

    View full-size slide

  39. NIH
    Why doesn’t Symfony just reuse existing libraries?

    View full-size slide

  40. Where is
    Waldo?
    Why doesn’t Symfony have feature X, Y or Z?

    View full-size slide