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

Server URL Helper Cleanup #160

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"ext-filter": "*",
"ext-json": "*",
"container-interop/container-interop": "^1.2",
"laminas/laminas-diactoros": "^2.13.0",
Copy link
Member

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 🤔

Copy link
Member Author

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 perhaps baseUrl at the very least.

Copy link
Member

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?

Copy link
Member

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...

Copy link
Member Author

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?

Copy link
Member

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!

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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!

"laminas/laminas-escaper": "^2.5",
"laminas/laminas-eventmanager": "^3.4",
"laminas/laminas-json": "^3.3",
Expand Down
209 changes: 208 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading