-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Server URL Helper Cleanup #160
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't think we should drag in a dependency for this 🤔
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.
I'm with you there, but I considered it better than attempting to parse
$_SERVER
inside this particular view helper.Perhaps just abandon the patch and remove the helper instead - i.e. make sure that both MVC and Mezzio have their own implementations to replace it prior to a release of 3.0.
There are probably other helpers that could do with the same treatment - thinking
url
and perhapsbaseUrl
at the very least.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.
Overall, I think this does bring value, and is implemented the right/safe way, but it also leads to the added dependency, which is a lot 🤔
Not sure what to do here. /cc @weierophinney maybe?
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.
I would likely copy over that functionality here and refactor to work with laminas-http. Since Diactoros is a PSR-7 library, there's a mismatch with the primary target of laminas-view (laminas-mvc). There's a reason we provide alternate url() and serverUrl() helpers in the mezzio-template-laminasview package...
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.
Can we/I create an entirely new library to contain everything that's MVC specific so that it can be stripped out in 3.0 - this could include all the supporting code around MVC events. If that's an agreeable path, I could just abandon this patch and deprecate the helper here entirely instead?
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.
I think that would be perfect, @gsteel!
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.
And we have to make sure that there is also a solution to create URLs with the same helpers when using laminas-cli. The server URL and the base path must be able to set via configuration, factory or something else.
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.
@froschdesign I'd argue that should be via separate helpers. Not quite sure how to manage it (right now, CLI config is the same as web config), but having separate helpers for separate contexts makes a lot of sense here to me.
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.
@weierophinney
I've made a start on this with just the ServerUrl and Url helpers specifically for MVC:
laminas/laminas-mvc-view#1
If this is a good enough starting point, is transferring the repo ownership an option?
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.
Yes - we usually vote on any new packages in the TSC; this sort of thing can happen between meetings, though. Feel free to initiate; contact me in Slack for tips on how to do it.
Looking forward to further decoupling!