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

Better support for Lumen: Return Illuminate\Http\Response instance #1051

Open
wants to merge 2 commits into
base: master
from

Conversation

@benjamindoe
Copy link

@benjamindoe benjamindoe commented Oct 20, 2020

Currently, with a Lumen application, $image->response() returns Symfony\Component\HttpFoundation\Response. This change compares the app() container with Illuminate\Container\Container and correctly returns an Illuminate Response without the use of a facade.

Removing the facade use is key as Lumen applications have facades disabled by default.

@benjamindoe benjamindoe changed the title Better support for lumen response Better support for Lumen: Return Illuminate\Http\Response instance Oct 20, 2020
@mfn
Copy link

@mfn mfn commented Oct 20, 2020

It his package officially compatible with Lumen?

The reason I ask is that the change is breaking backwards compatibility. Before this PR, you could have easily mocked (faked) the Facade for whatever reason, impossible now.

However you can enable Facades in Lumen. This should be carefully considered and needs a major version bump if it goes in IMHO.

@benjamindoe
Copy link
Author

@benjamindoe benjamindoe commented Oct 22, 2020

Good spot. I could easily just add it to another if statement.

I assumed the package was compatible with Lumen due to there being a Lumen-specific service provider.

You can enable Facades in Lumen but that doesn't fix the issue of incorrect response class being returned. Although it's wise for Lumen support to not rely of facades as it's enabled by default for performance gains.

@mfn
Copy link

@mfn mfn commented Oct 22, 2020

I assumed the package was compatible with Lumen due to there being a Lumen-specific service provider.

My apologies and I assert you're definitely right about this!

(doesn't change my technical feedback though)

@benjamindoe
Copy link
Author

@benjamindoe benjamindoe commented Oct 26, 2020

The latest commit checks whether facades have been "enabled". In Lumen, calling $app->withFacades() essentially sets the facade app. This is already set in a full Laravel application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.