spiral / framework

High-Performance PHP Framework
https://spiral.dev
MIT License
1.81k stars 88 forks source link

Provide a default renderer for stempler template engine #729

Open alexander-schranz opened 2 years ago

alexander-schranz commented 2 years ago

Description

Provide a default renderer for stempler template engine. Currently Stempler itself does only provide some components to create the template engine. The creation of the stempler template engine itself currently lives in the spiral/views package. As I'm currently working on bringing different template engines under one common interface (project can be found here) it would also be great to support Stempler Renderer directly without spiral/views. But if you say spiral/views is always the way how to use stempler I'm also fine with it.

Example

A default renderer in the stempler package would make it possible to use it without the spiral/views abstraction.

butschster commented 2 years ago

Hi @alexander-schranz!

Stempler doesn't use spiral/views directly. It can be used separate without framework as I can see. There is the stempler-bridge component where you can see integration with Spiral Framework. I think something similar you may use for integration with your great project.

if you need some help, then feel free ask me questions and I try to help you.

alexander-schranz commented 2 years ago

Its more about providing a default implementation with the stempler. As example there is a lot of logic to build usable stempler engine in spiral/views: https://github.com/spiral/stempler-bridge/blob/master/src/StemplerEngine.php. Which currently make the stempler package alone a little bit unusable without spiral/views. Had some discussion with @wolfy-j on discord and he said it maybe make sense to have a default renderer provided with stempler and I should fill a ticket, so I created this issue. As written if said spiral/views is always the way about using stempler I'm also fine with it then the bridge to spiral/views is enough for abstraction.

Yoskaldyr commented 7 months ago

I agreed with @alexander-schranz It will be great if some default implementation existed in Stempler, not only in spiral/views. Yes I understand that it's possible to write own implementation. But nonexistent default implementation stops to use this great engine as fast as Twig or Latte.