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

What's New in early 2023

What's New in early 2023

A lot has happened in the last year! 52 blog posts to keep you up to date with all the news, a bunch of pull requests, two new versions, a lot of features... Well, I'm sure you missed something. Let's have a look at what happened these last 12 months in the Symfony ecosystem.

Nicolas Grekas

March 24, 2023
Tweet

More Decks by Nicolas Grekas

Other Decks in Technology

Transcript

  1. 12 months of
    innovations 🪄
    @nicolasgrekas

    View Slide

  2. @nicolasgrekas
    • Joined in 2013 at v2.5
    • SensioLabs > Blackfire.io > Symfony Corp.
    • Admin board of the PHP Foundation
    • 3000+ PRs (10%)
    @nicolasgrekas

    View Slide

  3. symfony.com/releases
    @nicolasgrekas

    View Slide

  4. Symfony 6
    • PHP >= 8.1
    • Backward Compatibility promise
    • Upgrade every months for bug fixes
    • Upgrade 6 months for features
    @nicolasgrekas

    View Slide

  5. 6.1, 6.2, 6.3-dev
    Symfony 7 is coming!
    Continuous Upgrade
    Path promise
    Fix deprecations
    every 6 months
    Upgrade every 2 years
    @nicolasgrekas

    View Slide

  6. git diff --stat
    • 5 724 files changed
    • 570 318 insertions(+)
    • 35 622 deletions(-)
    @nicolasgrekas

    View Slide

  7. 5 merges / day
    • 484 minors
    • 468 bug fixes
    • 309 features
    • 497 merges up
    @nicolasgrekas

    View Slide

  8. Minors
    🧹
    @nicolasgrekas

    View Slide

  9. Performance
    #48802 Cut compilation time
    #49291 Add NormalizerInterface::getSupportedTypes()
    #49676 Improve performance of GlobResource
    #48469 Use WeakReference in the container
    #47094 Use xxh128 instead of sha256 for http cache store key
    @nicolasgrekas

    View Slide

  10. - return 'en'.hash('sha256', $content);
    + return 'en'.hash('xxh128', $content);
    ./{apps,src}/**/*Controller.php
    + $selfRef = \WeakReference::create($this);
    - $this->closure = fn () => $this->doSomething();
    + $this->closure = static fn () => $selfRef->get()->doSomething();
    @nicolasgrekas

    View Slide

  11. Types
    #49383 Add missing return types to interfaces
    #49022 Add missing template notation on ServiceLocator
    #48750 Add generics to PasswordUpgraderInterface
    #47390 Remove @inheritdoc
    @nicolasgrekas

    View Slide

  12. + /**
    + * @template T
    + *
    + * @param T $var
    + *
    + * @return T
    + */
    function dump(mixed $var, mixed ...$moreVars): mixed
    {
    @nicolasgrekas

    View Slide

  13. PHPUnit 10
    #49663 Remove withConsecutive() calls from tests
    #49233 Use PHPUnit 9.6 to run Symfony's test suite
    #48668 Migrate to static data providers
    #49253 Use TestCase suffix for abstract test cases
    @nicolasgrekas

    View Slide

  14. - public function provideUidEntityClasses()
    + public static function provideUidEntityClasses()
    @nicolasgrekas

    View Slide

  15. New syntax
    #48793 Leverage arrow function syntax for closure
    #48670 Use ::class
    #48069 Use ??= more
    #47672 Leverage First-class callable syntax
    @nicolasgrekas

    View Slide

  16. - $this->class = get_class($object);
    + $this->class = $object::class;
    - $values = array_filter($values, function ($val) { return null !== $val; });
    + $values = array_filter($values, fn ($val) => null !== $val);
    - if (null === $path) {
    - $path = '/';
    - }
    + $path ??= '/';
    - Loop::defer([Loop::class, 'stop']);
    + Loop::defer(Loop::stop(...));
    @nicolasgrekas

    View Slide

  17. Improvements
    #46392 Add favicon to welcome 👋 and error pages ❌
    #48705 Stop considering empty env vars as populated
    #49625 Keep track of decorated ids
    @nicolasgrekas

    View Slide

  18. $ bin/console debug:autowiring
    - Symfony\Contracts\HttpClient\HttpClientInterface (.debug.http_client)
    + Symfony\Contracts\HttpClient\HttpClientInterface (http_client)
    @nicolasgrekas

    View Slide

  19. Continuous
    Integration
    #49001 Speed up Psalm tests (12 to 2 minutes)
    #47180 Add ossf/scorecardGitHub action
    @nicolasgrekas

    View Slide

  20. Features
    🤩
    @nicolasgrekas

    View Slide

  21. ⌚ 🤝 🕸 📅
    New components
    #46715 Add the Clock component
    #48542 Add the RemoteEventand Webhook
    #47112 Add a scheduler component
    #48371 Add ImportMaps to manage JS deps without nodejs
    @nicolasgrekas

    View Slide

  22. ⚰️
    SensioFramework
    ExtraBundle
    #46880 Add #[Cache] to describe cache headers on controllers
    #46907 Add #[IsGranted] to check roles on controllers
    #46906 Add #[Template] to render arrays using templates
    #43854 Add #[MapEntity] together with EntityValueResolver
    @nicolasgrekas

    View Slide

  23. #[Route('/user/{id}')]
    #[Template('user/show.html.twig')]
    #[IsGranted('ROLE_USER')]
    #[Cache(smaxage: 60)]
    public function show(User $user)
    {
    return [
    'user' => $user,
    ];
    }
    @nicolasgrekas

    View Slide

  24. 🕹️
    Controllers
    #49358 Deprecate @route annotations in favor of attributes
    #49134 Add #[MapQueryParameter]to map query parameters
    #49138 Add #[MapRequestBody] and #[MapQueryString]
    #47709 Add StreamedJsonResponsefor efficient JSON streaming
    @nicolasgrekas

    View Slide

  25. 🌽
    HttpKernel
    #48352 #[WithHttpStatus] for defining status codes for exceptions
    #48747 #[WithLogLevel] for defining log levels for exceptions
    @nicolasgrekas
    #[WithHttpStatus(429, ['Retry-After' => 10])]
    #[WithLogLevel(LogLevel::INFO)]
    class RateLimitedException extends \Exception
    {

    View Slide

  26. 🛡️
    Security
    #46428 Add token-based authentication
    #41274 Add Security::login()to login programmatically
    #41406 Add Security::logout()to logout programmatically
    #49306 Add logout configuration for Clear-Site-Dataheader
    @nicolasgrekas
    Clear-Site-Data: "cookies"

    View Slide

  27. 🧙‍♂️
    Dependency
    Injection 1/2
    #47680 Remove parameters starting with a dot when compiling
    #47719 Add ContainerBuilder::deprecateParameter()
    #49411 Add support for #[AsAlias] during auto-discovery
    @nicolasgrekas

    View Slide

  28. @nicolasgrekas
    #[AsAlias('my-alias', public: true)]
    #[AsAlias(MyInterface::class)]
    class MyService implements MyInterface
    {

    View Slide

  29. 🧙‍♀️
    Dependency
    Injection 2/2
    #46752 Generate lazy proxies out of the box
    #48484 Deprecate proxy-manager bridge
    #49685 Add support for #[Autowire(lazy: true)]
    #49628 Autowire services as closures with #[AutowireCallable]
    @nicolasgrekas

    View Slide

  30. @nicolasgrekas
    public function __construct(
    #[AutowireCallable(UriTemplate::class, 'expand')]
    UriExpanderInterface $expander,
    )
    new class($uriTemplate->expand(...)) implements UriExpanderInterface {
    public function __construct(
    private \Closure $closure,
    ) {
    }
    public function expand(string $url, array $vars): string
    {
    return $this->closure->__invoke($url, $vars);
    }
    }
    $uriTemplate->expand(...)

    View Slide

  31. 🫶
    Developer
    eXperience
    #47352 Remove profilesautomatically after two days
    #48059 Auto-create Doctrine migrations for sessions and locks
    #46895 Add NotificationAssertionsTrait
    #48707 Fail if #[Target] attribute does not exist during compilation
    #48938 Allow setting private services with the test container
    #48432 Add support of named arguments to dd() and dump()
    @nicolasgrekas

    View Slide

  32. @nicolasgrekas
    static::getContainer()
    ->set('http_client', new MockHttpClient(...));
    dump(hello: 'World');

    View Slide

  33. 🎁
    Various Goodies
    #47525 Add UuidV7 and UuidV8
    #49529 Add support for better signal handling in commands
    #49302 Add UriTemplateHttpClientto use RFC-6570
    #49300 Add #[NoSuspiciousCharacters]to spot spoofing attempt
    @nicolasgrekas

    View Slide

  34. 🔔️
    Notifier
    #47373 Add Chatwork bridge
    #46395 Add Contact Everyone bridge
    #46724 Add SMSFactor bridge
    #49454 Add Pushover bridge
    #49461 Add MailerSend bridge
    #48855 Add PagerDuty bridge
    #48101 Add Mastodon bridge
    #48466 Add Line bridge
    #48389 Add Bandwidth bridge
    #48394 Add Plivo bridge
    #48397 Add RingCentral bridge
    #48398 Add Termii bridge
    #48399 Add iSendPro bridge
    #48084 Add Twitter bridge
    @nicolasgrekas

    View Slide

  35. Help Wanted
    See issues with
    "Help Wanted" label
    Contribute to the
    documentation!
    @nicolasgrekas

    View Slide

  36. 360+ contributors
    @nicolasgrekas

    View Slide

  37. Backers for 6.2
    @nicolasgrekas

    View Slide

  38. Backers for 6.3
    @nicolasgrekas

    View Slide

  39. symfony.com/
    sponsor
    • Become a backer
    • Deploy on Platform.sh
    • Attend Symfony conferences
    • Get certified
    • Sign up for SymfonyInsight
    • Buy the Symfony book
    • Subscribe to SymfonyCasts
    @nicolasgrekas

    View Slide

  40. symfony.com/slack
    Mutual aid
    Kindness
    CARE team
    @nicolasgrekas

    View Slide

  41. Merci ! 🫶
    @nicolasgrekas

    View Slide