A
A
anna_makeenko2019-12-01 22:05:41
PHP
anna_makeenko, 2019-12-01 22:05:41

How to use the PSR-18 correctly?

Maybe someone has already met a package where you can borrow an example of using PSR-18?
Let's say you need to write a simple package to check the availability of goods in online stores. Each store provides its own API, i.e. the request and its parameters will be different for each store.

src/
- Providers
-- AbstractProvider.php
-- Shop1Provider.php
-- Shop2Provider.php
- ProviderInerface.php
- ProviderBuilder.php

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2019-12-01
@Sanasol

How to use the PSR-18 correctly?

$client = new HttpClientWithPsr18();
$client->sendRequest(new RequestFromPSR7());

something like this.
And here psr and even 18?
Exactly one method for implementation is described there, and a bunch of http clients in php have supported this PSR for a long time, although this is very loudly said. THERE IS ONE METHOD.
write, autoload, "OOP" and documentation to help.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question