Laravel Blade Capture Directive is a fantastic package that introduces a new @capture directive that allows you to capture small parts of your Blade templates and re-use them later on without needing to extract them into partials. This package adds a new pair of directives: @capture and @endcapture. The @capture directive will capture all of your Blade until it reaches an @endcapture directive.

The above code will invoke your captured Blade code and output Hello, world!

This means you can assign default values and specify multiple arguments: @capture($hello, $name, $greeting = 'Hello, ') {{ $greeting }} {{ $name }}!
Newsletter

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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners