Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WordPress/Requests in autodiscovery and PSR-18/PSR-17 provider #259

Closed
Art4 opened this issue Jan 18, 2024 · 1 comment
Closed

Add WordPress/Requests in autodiscovery and PSR-18/PSR-17 provider #259

Art4 opened this issue Jan 18, 2024 · 1 comment

Comments

@Art4
Copy link

Art4 commented Jan 18, 2024

Description

WordPress/Requests is a HTTP request library that is used in WordPress, but is also used as a standalone library. While Requests does not implement PSR-18 itself, they recommend to use WP-Requests-PSR18-Adapter allowing developers to use Requests as a PSR-18 HTTP client.

Full disclosure: I'm the maintainer of the WP-Requests-PSR18-Adapter library.

Example

If a project already have Requests installed, Discovery could auto-install WP-Requests-PSR18-Adapter.

Additional context

At the moment v1.2.0 implements theses interfaces:

  • Psr-18 ClientInterface
  • Psr-17 RequestFactoryInterface

These interfaces are partially implemented or planned:

  • Psr-17 StreamFactoryInterface (partially)
  • Psr-17 UriFactoryInterface (planned)

If this proposal is accepted I'd be glad to open a PR.

@dbu
Copy link
Contributor

dbu commented May 7, 2024

hi @Art4 thanks for reaching out. looks like a good approach to satisfy wordpress legacy support aims but also provide a modern integration for those who want it.

i discussed that with other maintainers, and we think at the current state, we'd rather not include this wrapper at this time. it is not a complete implementation of PSR-17, and usage numbers are low.
if the client becomes more widely used, please ping us again and we can reconsider.

our recommended pattern is to allow explicitly injecting a client and only fall back to discovery. libraries using that approach will work fine with the wrapper when setting it up manually. even libraries that rely only on discovery can be made to work by providing and registering a custom strategy, see the strategy documentation - the registering needs to be done in the code using your client but you could document how to do it.

@dbu dbu closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants