Appstract Laravel Blade Directives

Appstract Laravel Blade Directives

With no shortage of excellent blade extensions circulating in the community, you should also check out the appstract/laravel-blade-directives package.

Whether you end up installing the package or copying a few that you like to your project, here are some notable directives from the project:

Quickly output a font-awesome icon:


Check if the current route name matches:

    Do something only on the checkout

Only show when $variable isset and true.

   This will be echoed

Or you can do it inline:

@istrue($variable, 'This will be echoed')

@dump and @dd:


Load the contents of a CSS or js file inline in your view:


Create a <script/> element with or without a js path:

    alert('hello world')


Create a <style/> element or <link/> element with a css path:

    body { background: black }


Same as @push but will include content one time only. Useful for repeatable blocks following the syntax “stack-name:group-name”:


<script src="{{ asset('/js/foobar.js') }}"></script>


What’s Next?

To learn more about this package check out the GitHub Repository which includes all the instructions and everything you’ll need to get started. We’ve also covered Appstract’s Laravel OPCache package, which you should check out as well.

The framework itself has introduced some new convenient Blade features recently. In Laravel 5.5 LTS, the @auth and @guest directives were added. Another nice feature added to 5.5 is adding conditionals with Blade::if(). In 5.5.3, the @json directive was added to make outputting JSON objects in JavaScript easier.

Filed in: Laravel Packages / Blade


Join the weekly newsletter and never miss out on new tips, tutorials, and more.

Laravel News Partners

Laravel Jobs

Senior PHP Developer (Full Stack | CakePHP | Laravel | Vue | jQuery)
Senior Laravel Developer (Full-Stack)
Volunteer Vision GmbH
Full-Stack Developer
Nu Image Medical
Senior Software Developer
Remote (US ONLY)/Kenilworth, NJ
Senior Back-end Laravel API Developer - Immediate Contract (Full Time)
ApproveMe // Document Signing
Web Development Project Manager
Houston, TX
Swyft Filings
Experienced Laravel/VueJS Developer (Freelance)
Remote (preferably in the US)
Prosperly LLC