Open weierophinney opened 4 years ago
6 years passed since original post.. guys, any roadmap or best practice?
who can clearly describe how to use url
-helper (ServerUrl
and others) inside console-application?
thanks!
@lon9man
who can clearly describe how to use
url
-helper (ServerUrl
and others) inside console-application?
Create and register a factory for the helper which uses the configuration. Here is an example.
@froschdesign thanks for the reply! i checked sources.
questions:
UrlFactory
something related to server_url
-option in config. will it assemble routes in console successfully? laminas-mvc-view
-library in the docs/google. what is it? it was made to resolve this specific issue with ServerUrl
?thanks!
@lon9man
- i don't see in
UrlFactory
something related toserver_url
-option in config. will it assemble routes in console successfully?
The Url
helper does not create fully qualified domain name (absolute URL) by default and is not intended for this purpose at all.
For CLI usage you can combine the ServerUrl
helper and the Url
helper or replace the Url
helper with a custom one.
2. i don't see
laminas-mvc-view
-library in the docs/google. what is it? it was made to resolve this specific issue withServerUrl
?
This new / unreleased package extracts the MVC components from laminas-view with the goal of using laminas-view and its Url helpers as a standalone and providing (better) CLI support.
If you have any further questions, please use the forum or the chat.
In every project I see people working around the Url ViewHelper not working in console context.
If there was a config option like below we could have one standardized way of solving this.
Example of my latest workaround: https://stackoverflow.com/a/52248041/1899162
Secondarily we could then also use this option to make the ServerUrl ViewHelper work in console context.
@weierophinney do you want this PR for this repository or for Zend\View?
Originally posted by @Erikvv at https://github.com/zendframework/zend-router/issues/51