The PHP podcast where everyone chimes in.

Originally aired on

January 5th, 2017

058: HTTPlug, Guzzle & API's

Guzzle has become the de-facto HTTP-client library for PHP. But recently a number of open source projects have been switching to HTTPlug which boasts itself as an HTTP-client abstraction. We chat about the problems HTTPlug aims to solve, the plans for its future and the reasons behind why some library maintainers have chosen to adopt it or not.

with


HTTPlug, Guzzle & API's Show Summary


Tobias, how did you get involved in Guzzle?

  • Michael tweeted a call for an additional maintainer.
  • Tobias answered the call.
  • Márk Sági-Kazár is also a superstar maintainer on the project.
  • Guzzle has released several major releases in a fairly short space of time, which has lead to some conflicts. The Guzzle community will be more careful about a version 7 release.

What does HTTPlug offer that Guzzle doesn't?

  • HTTPlug is an abstraction over HTTP clients and provides a consistent PSR-7 compliant wrapper over multiple HTTP clients.
  • It grew out of Ivory HTTP Adapter.
  • Using HTTPlug means your code depends on an HTTP abstraction rather than an HTTP implementation.

How do I migrate to HTTPlug?

  • It depends on how coupled you are to an existing implementation.
  • You need 3 libraries/packages to implement HTTPlug:
    • A HTTP message (PSR-7 implementation)
    • A way to create the message (message factory)
    • A way to send the message (HTTP client)
  • Users of libraries that use HTTPlug may choose their own packages/implementations or library maintainers may specify default implementations.
  • HTTPlug is for library authors. Application developers are consumers of HTTPlug.

Brian talks about Stormpath PHP SDK's migration to HTTPlug

  • Stormpath SDK was using Guzzle 3 which is now abandoned.
  • Lack of other dependencies/integrations allowed Stormpath to avoid upgrading.
  • Once they started adding more integrations, this lead to problems with conflicting version requirements.
  • There was some debate over whether to migrate to a newer version of Guzzle or use something else.
  • HTTPlug represented a more versatile solution.
  • Tobias and Magnus Nordlander helped them to migrate.
  • Stormpath provide default implementations for HTTPlug to wrap, but users may change them.

Woody, what are the reasons for thephpleague/oauth2-client sticking with Guzzle?

  • thephpleague/oauth2-client recently decided against migrating to HTTPlug.
  • Guzzle is the de-facto standard.
  • Guzzle 6 is PSR-7 now compliant.
  • With wider adoption of PSR-7, there is less need for an abstraction library like HTTPlug. PSR-7 provides that abstraction.
  • HTTPlug can add complexity for your users if you force them to pick their own implementations.

Is this a transient problem, is there a long-term need for an abstraction like HTTPlug?

  • Building HTTPlug was something that could be done quickly. PSRs move slowly.
  • There are several upcoming PSR standards (PSR-15, PSR-17) which should help to resolve these issues.
  • In principle, these upcoming PSRs should solve problems, but during the transitional phase of libraries adopting these standards, we may still need adapters.

Woody Gilk


Steven Maguire

  • Built and launched a product that protects your email inbox from being overrun with system monitoring alerts via rules and filters. I am looking for a few more beta testers to signup and put it through its paces. Signup at alertupgrade.com!
  • Loves pizza, especially when other people pay for it @ steven.pizza :)
  • Read The Axis of Stevil for new hilarious/odd content every Monday, Wednesday, and Friday, email notifications when new content is released.

Brian Retterer


Show Notes Credit

Chris Shaw

Thank you Chris Shaw for authoring the show notes for this episode!

If you'd like to contribute show notes and totally get credit for it, check out the show-notes repo!