HTTPClient advanced usage and best practices

Abstract

On Thursday, September 2nd

Symfony HttpClient has been introduced 2 years ago with a unique design that made it both trivial to use for common use cases and powerful enough to cope with any advanced needs. Since then, the community has kept improving it by adding new features.

In this session, we will practice the component together in depth. We'll start with simple synchronous use cases, then we'll learn how to use its async capabilities to write super-fast API clients. We'll also learn how to stream big requests and responses, and how to control streams, pause them, multiplex them, etc.

Because the component implements four abstractions, we'll also discuss about software architecture / OOP / SOLID principles, so that you can make your opinion about which abstraction you can use in each situation.

Then, we'll learn how to extend HttpClient using its decorator-based design. Can you auto-retry a request? Auto-refresh an OAuth token while hitting an API? Asynchronously? You will if you attend this workshop!

Of course, we'll practice this in a Symfony app, so that you'll know how to configure and autowire scoped clients that do conditional authentication based on the host they hit.

As you know, software programming is about making things work. In any docs, the "happy path" is always detailed, but things usually don't work, before they do. During this session, we'll hit issues, failures, things that don't work, and you'll learn how to overcome them and get fluent into HttpClient.

Part of

Symfony track

A track dedicated to Symfony PHP framework and related topics.

Speaker(s)

Nicolas Grekas

Nicolas Grekas

Symfony

Nicolas works as Principal Engineer at Symfony, the company. Prior to that, he worked as a CTO for Blackfire.io, the PHP profiler that we were all missing. He is Symfony core team member & top-ranking contributor.