-
-
Notifications
You must be signed in to change notification settings - Fork 57
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 HTTP message converters for controllers #89
PSR HTTP message converters for controllers #89
Conversation
$container->services() | ||
->set('nyholm.psr_factory', Psr17Factory::class) | ||
->alias(ResponseFactoryInterface::class, 'nyholm.psr_factory') | ||
->alias(ServerRequestFactoryInterface::class, 'nyholm.psr_factory') | ||
->alias(StreamFactoryInterface::class, 'nyholm.psr_factory') | ||
->alias(UploadedFileFactoryInterface::class, 'nyholm.psr_factory') | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 The recipe for nyholm/psr7
provides this piece of configuration already.
$container->services() | ||
->defaults()->autowire()->autoconfigure() | ||
->set(HttpFoundationFactoryInterface::class, HttpFoundationFactory::class) | ||
->set(HttpMessageFactoryInterface::class, PsrHttpFactory::class) | ||
->set(PsrResponseListener::class) | ||
->set(PsrServerRequestResolver::class) | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 A new recipe for psr-http-message-bridge
should provide this piece of configuration.
2cf933e
to
ed9e273
Compare
CI failure is unrelated. I'll work on a separate PR to upgrade the CI for the year 2021. 😃 /edit: #90 |
2068ce5
to
2ca0157
Compare
Recipe: symfony/recipes#899 |
2ca0157
to
d5ecc48
Compare
d5ecc48
to
aa26e61
Compare
This PR proposes to add two classes to
symfony/psr-http-message-bridge
that have been removed fromsensio/framework-extra-bundle
.By adding
PsrServerRequestResolver
andPsrResponseListener
to its service container, with autowring and autoconfiguring enabled, an application gains the ability to operate controllers on PSR-7 message objects instead of HttpFoundation.This is especially useful if a developer wants to reuse generic packages like
league/oauth2-server
.Configuration files for autowiring the two classes can be provided as Flex recipes.