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

Register missing PSR interfaces to services #16696

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Jan 26, 2025

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, 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/a

@Mark-H Mark-H requested a review from opengeek as a code owner January 26, 2025 11:28
@Mark-H Mark-H added this to the v3.2.0 milestone Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant