Web Summer Camp Croatia: Writing API clients with HTTPlug

Web Summer Camp Croatia: Writing API clients with HTTPlug

Conference: Web Summer Camp, Croatia
Title: Writing API clients with HTTPlug
Links: slides, tutorial repository
Co-Presenter: Márk Sági-Kazár

This was a 3 hour tutorial with many exercises the participants could do.

PSR-7 defines common interfaces for HTTP requests and responses but the libraries that need to send HTTP requests need more than that. HTTPlug defines an interface for HTTP clients and provides adapters for existing clients like Guzzle, as well as a plugin system operating directly on PSR-7. This tool chain allows building API clients that do not depend on a specific HTTP client at all.

This workshop by the two of the main authors of HTTPlug will cover:

  • Working with PSR-7 request and response
  • Using HTTPlug and the MessageFactory
  • Bootstrapping clients explicitly or with Puli
  • Using the PHP-HTTP plugin system
  • Strategies for writing an API client.