Open alexander-schranz opened 2 years ago
Well, any of the template engines etc could work that way in Laminas, as far as I know. I am working on an example as we speak.
Yeah think the todo would be creating for every Laminas Integrations (Latte, Twig, Blade, ...) also the following classes/services:
They can live in the specific Laminas Modules (laminas-latte-integration, ...) think the packages need then a requirement to laminas/laminas-view
but think that is fine as laminas/laminas-view
is a core packages and already requirement of the skeleton.
I already have the Strategy, Renderer (which you have as well I think), and the LatteModel.
I have also included a ModuleManager provider for Latte. It provides a method much like getConfig via its Interface for adding Latte configuration (via its own custom key) from a module.config.php (would be helpful if a module needs to add a custom extension via the LattePluginManager, which I will include most likely). Not sure if that would be needed, but, since configuration is many times, on a per module basis, such as for the view_manager and its path to the view files relative to the modules path. Im trying to workout the simplest way to load those paths because full integration, with laminas-view would depend on a modules view files being in each module, not on a single path since the module should contain all of its files, if not then its dependent on another module. I need to do some more reading on exactly what the Latte FileLoader supports and how best to tie that together.
I have also included a ModuleManager provider for Latte. It provides a method much like getConfig via its Interface for adding Latte configuration (via its own custom key) from a module.config.php.
Okay didn't find anything like that. I currently did done it this way: https://github.com/schranz-templating/templating/blob/cf6a7ad097339898d8e3d7406856d192dbef952b/src/Integration/Laminas/Latte/Module.php#L27
But if there is a way to register schranz_templating_latte
as an module config key it would be sure the better solution. So all config which is currently done via that should then in my case moved th the new ModuleManager configuration: https://github.com/schranz-templating/templating/blob/cf6a7ad097339898d8e3d7406856d192dbef952b/src/Integration/Laminas/Latte/config/module.config.php#L6-L12 and read correctly in the Module.php from the ModuleManager.
PS: Latte does not support multiple paths. So it can only be used inside a project not be used by other modules. That is currently a limitation of latte which example twig does not have.
Yeah think the todo would be creating for every Laminas Integrations (Latte, Twig, Blade, ...) also the following classes/services:
* Renderer (implemented the Laminas RendererInterface - LatteRenderer, TwigRenderer, ...) * Strategy (LatteStrategy, TwigStrategy, ...) * ViewModel (LatteModel, TwigModel, ...)
They can live in the specific Laminas Modules (laminas-latte-integration, ...) think the packages need then a requirement to
laminas/laminas-view
but think that is fine aslaminas/laminas-view
is a core packages and already requirement of the skeleton.
Well, it would need the requirement I think. If the integration is total, then it could be used outside of the MVC context.
Well, it would need the requirement I think. If the integration is total, then it could be used outside of the MVC context.
Not sure what you mean outside the MVC context. It can be used everywhere where laminas modules works. Currently it just works also without the requirement to laminas-view but if we add integration to laminas-view it will require that dependency. But think that does not hurt in context as I think every laminas project alreay would require some kind of a view component.
But as example mezzio will have its own integration as it has its own way of integrating template engines. So we don't need to keep mezzio in mind for the laminas integration.
OK a single path actually simplifies it. I will push this code sometime tonight. Honestly, you will need to check the repo and use any of it that you can and incorporate into your workflow as I have not yet cloned your repo (so cant open a pull request currently) as our dev environments are setup drastically different.
(I was actually responding to another comment, github, go figure lol) Laminas-view can be used as a standalone component outside of both Laminas-mvc and Mezzio
Well, it would need the requirement I think. If the integration is total, then it could be used outside of the MVC context.
Not sure what you mean outside the MVC context. It can be used everywhere where laminas modules works. Currently it just works also without the requirement to laminas-view but if we add integration to laminas-view it will require that dependency. But think that does not hurt in context as I think every laminas project alreay would require some kind of a view component.
But as example mezzio will have its own integration as it has its own way of integrating template engines. So we don't need to keep mezzio in mind for the laminas integration. You can use Laminas-view as a standalone component.
Laminas has additional View abstraction and it would be nice if the integrations also are integrated into that one.
A response I got from @Tyrsson which describe how that implementation should work for Latte: