Commit 11d9666
authored
Register missing PSR interfaces to services (#16696)
### What does it do?
Registers the Guzzlehttp implementations of PSR interfaces
ResponseFactoryInterface, UploadedFileFactoryInterface, and
UriFactoryInterface into the services container.
### Why is it needed?
While we offer [a bunch of interfaces as part of the core services
already](https://docs.modx.com/3.x/en/extending-modx/services/http), I
ran into needing the ResponseFactoryInterface to create response classes
on a project.
I then double checked what other interfaces we can already provide
through guzzlehttp/psr7 and made sure we're adding them all in.
### How to test
```
$factory = $this->modx->services->get(ResponseFactoryInterface::class);
$response = $factory->createResponse($statusCode)
->withHeader('Content-Type', 'application/json')
->withHeader('Access-Control-Allow-Origin', '*');
$response->getBody()->write(json_encode($data));
```
### Related issue(s)/PR(s)
N/a1 parent 0ad09ef commit 11d9666
1 file changed
+18
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
2742 | 2745 | | |
2743 | 2746 | | |
2744 | 2747 | | |
| 2748 | + | |
| 2749 | + | |
| 2750 | + | |
| 2751 | + | |
| 2752 | + | |
2745 | 2753 | | |
2746 | 2754 | | |
2747 | 2755 | | |
2748 | 2756 | | |
2749 | 2757 | | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
| 2764 | + | |
| 2765 | + | |
| 2766 | + | |
| 2767 | + | |
2750 | 2768 | | |
2751 | 2769 | | |
2752 | 2770 | | |
| |||
0 commit comments