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

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