Blade is a PHP templating framework to use with your Laravel application. The blade templates are compiled down to normal PHP code. We can also extend blade by creating our own custom functions and directives to make our templates easier to handle.

That's all the code you need to help clean up your blade templates and create your own blade directives. https://paulund.co.uk/how-to-create-a-custom-blade-directive#view-cacheOne thing to remember is that Laravel will cache your view files with the compiled code from your custom blade directives.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners