Why Octobercms not support blade template engine like twig

Hello guys, i hope you all doing fine, i just recently in a project did some pdf generation using dompdf library and also i tried spatie package also , and it was a good experience cause they are package of laravel and they support blade .

but when i want to write email , i write it using twig template
why octobercms dosent consider using blade or at least support blade ?

Hi @Yassineafaila

It’s a common question. Twig has a sandbox (safe mode), Blade is an extension of raw PHP and isn’t secure at all.

We could consider adding it as an alternative format. Why would you like us to consider supporting Blade?

i didnt know that twig is more secure then blade .
why i prefer supporting blade cause i came from laravel to octobercms , so i more familiar with blade then twig.
all packages that are supported by laravel they use blade as template engine
and one other thing. this is only for me is that twig is ugly in syntax compared to blade.

1 Like

The Blade engine is still shipped with October CMS, so the packages still work as expected via View::make().

The Blade support we are discussing would be within themes only, so I suppose that if you are copying markup from packages, it might make sense, although rare.

Ugly is not a particularly strong argument, since Twig as a syntax is more widely adopted in the overall web development ecosystem, including outside PHP. Blade is only found in Laravel or .NET (Razor).

In addition to October CMS, Twig is used in Symfony, Drupal, Jinja (Python), Nunjucks (Node.js), Liquid (Ruby, Shopify), Django (Python)… just to name a few.

It is worthwhile learning Twig, or at the very least, understanding it.

1 Like

Ohhh That’s Insightful.
i didn’t know that twig is used in many projects , I thought that it only exists on the php world, And For That i will give it a try to work with it instead of using blade ,
for the other part themes ,I rarely use the theme in octobercms
i use only octobercms for developing RestApi.

1 Like