Home > database >  Symfony like view helpers in laravel?
Symfony like view helpers in laravel?

Time:09-26

Symfony has this:

https://symfony.com/doc/4.1/components/templating.html#helpers

I can't find laravels equivalent? What do people use in Laravel in place of this?

I myself have tried creating custom helpers.php, which is good for some use cases I guess, but now I'm at the point, where I would like something a little bit more structured.

I am thinking maybe Facades would be be good option?

Is there anything else I could take a look at for Symfony's template helpers equivalent in Laravel?

CodePudding user response:

I would say the closest thing to this is directives. It allows you to add new methods to blade that you can use. Can find the docs here

You can also add a new facade if you need something more complex that will be accessable from the view layer as well.

Hope this helps!

  • Related