ryangjchandler/blade-capture-directive
Adds a @capture Blade directive to capture and store rendered template output in a variable for reuse later in the view. Useful for building snippets, components, and deferred sections without extra buffering or complicated view logic.
Use Case Fit:
Avoid If:
For Executives: "This package lets our frontend team build reusable UI components 10x faster by embedding snippets directly in Blade templates—no extra files, no context-switching. It’s a low-risk way to modularize our views, reduce technical debt, and keep designers/developers aligned. Think of it as ‘copy-paste on steroids’ for Laravel: smaller templates, easier maintenance, and faster iterations. MIT-licensed, battle-tested, and ready to deploy."
For Engineering: *"Blade Capture Directive solves a painful gap in Laravel’s templating: creating reusable partials without bloating the filesystem. Key benefits:
@capture('alert') ... @endcapture) without separate files.For Designers/Devs:
*"Tired of jumping between resources/views/partials/ and your main template? This lets you define and reuse UI snippets in one file:
@capture('user-card')
<div class="card">
{{ $user->name }}
<button>@include('buttons.primary')</button>
</div>
@endcapture
{{ $userCard }}
How can I help you explore Laravel packages today?