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

PSR 18 compatibility #632

Open
faizanakram99 opened this issue Jan 8, 2024 · 3 comments
Open

PSR 18 compatibility #632

faizanakram99 opened this issue Jan 8, 2024 · 3 comments

Comments

@faizanakram99
Copy link

Hi,

Thank you for this package.
I see that this package depends upon guzzlehttp/guzzle, while it is a very good package it adds one more dependency to the projects using this package. Can this depend upon psr18 instead. I think guzzle already implements it (https://packagist.org/providers/psr/http-client-implementation).

Depending upon psr http client would allow projects to use this package using http client of their choice and if a psr 18 client is already installed that will be used.

@DannyvdSluijs
Copy link
Contributor

@faizanakram99 I would think that is impossible due to the fact this library uses a specific part of Guzzle, namely the middleware support (see https://github.com/picqer/exact-php-client/blob/main/src/Picqer/Financials/Exact/Connection.php#L115)

As far as I can recall this isn't part of the PSR-18 so specifically Guzzle is needed for this lib to work. Do you think differently or have more in depth knowledge about PSR-18 in combination with middleware, that is applicable to this context?

@faizanakram99
Copy link
Author

@faizanakram99 I would think that is impossible due to the fact this library uses a specific part of Guzzle, namely the middleware support (see https://github.com/picqer/exact-php-client/blob/main/src/Picqer/Financials/Exact/Connection.php#L115)

As far as I can recall this isn't part of the PSR-18 so specifically Guzzle is needed for this lib to work. Do you think differently or have more in depth knowledge about PSR-18 in combination with middleware, that is applicable to this context?

I don't see any usage of insertMiddleware in this package, it looks like it has been added just as a convenience method.
The inserted middlewares are used before instantiating $client. You can already set a client via setClient method, and folks setting client can also set middleware beforehand, nothing needs to change there, it is just this package won't be exposing any convenience method specific to guzzle. The package can depend upon php-http/discovery instead https://docs.php-http.org/en/latest/httplug/library-developers.html

@remkobrenters
Copy link
Collaborator

Like Danny I am not familiar enough with the PSR-18 specs to know for sure in the end functionally nothing changes for people who use the middleware. It is a breaking change and I am not sure if removing the dependency on Guzzle is worth the effort. Is there someone else with more insights on this one to come up with a balanced opinion about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants