New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

jacksleight/blade-snip

76 20

Larablocks Analysis

jacksleight/blade-snip works with Laravel 8 to 11 (latest release 0.3.0, Mar 28, 2024), all past end of life (the last on Mar 12, 2026): no more fixes, even for security.

Recommendation checks

Not advised

Not advised: no release or commit in over 2 years.

  • No release or commit in over 2 years
  • Supports only Laravel 8 to 11, past end of life since Mar 12, 2026
  • No release in the last 12 months (last: Mar 28, 2024)
  • 0 downloads a month (needs 10,000)
  • 20 GitHub stars (needs 100)

State

Likely abandoned
  • No release or commit in over 2 years.
  • Last stable release: Mar 28, 2024.
  • No releases in the last 12 months.
  • First released: Mar 2, 2022.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.

Install
composer require jacksleight/blade-snip
Latest Version:0.3.0
PHP:^7.4|^8.0|^8.1|^8.2|^8.3
Laravel:8 – 11
Last Updated:Nov 14, 2024
Links: GitHub  ·  Packagist
Maintainer: jacksleight

Packagist version License

Blade Snip

Blade Snip allows you to use parts of a blade template multiple times. Basically partials, but inline:

<div class="products">
    @snip('product', ['image' => null])
        <div class="product">
            @if ($image)
                <img src="https://raw.githubusercontent.com/jacksleight/blade-snip/HEAD/{{ $image }}">
            @endif
            <h1>Lorem Ipsum Dolor</h1>
            <p>£{{ number_format($price ?? rand(10, 100)) }}</p>
            <button>Add to Basket</button>
        </div>
    @endsnip
    @stick('product')
    @stick('product', ['image' => 'cheese.jpg'])
    @stick('product', ['image' => 'potato.jpg', 'price' => 120])
    {{-- or --}}
    @spread('product', 3)
</div>
@snip('content')
    <x-figure caption="Lorem ipsum dolor sit amet">
        <img src="https://raw.githubusercontent.com/jacksleight/blade-snip/HEAD/photo.jpg">
    </x-figure>
@endsnip
@if ($link)
    <a href="https://github.com/jacksleight/blade-snip/blob/HEAD/{{ $link }}">@stick('content')</a>
@else
    @stick('content')
@endif
@snip('complex_thing')
    ...
@endsnip
<div class="mobile">
    <h2>{{ $name }}</div>
    <p>{{ $location }}</div>
    <div>@stick('complex_thing')</div>    
</div>
<table class="desktop">
    <tr>
        <th>{{ $name }}</td>
        <td>{{ $location }}</td>
        <td>@stick('complex_thing')</td>
    </tr>
</table>

Why?

I created this to use when prototyping page layouts. It's useful to have reusable blocks, but I don’t want to jump between multiple files, or don’t know exactly how those files should be structured yet.

This was primarily intended as a development tool, it’s usually best to break things down into actual partials or components once you’re done prototyping. That being said, there are other potential use cases.

Installation

Run the following command from your project root:

composer require jacksleight/blade-snip

Usage

Check the examples above.

Directives accept the following arguments:

  • @snip(string $name, ?array $defaults = []) … @endsnip
    • Defines a new snip
  • @stick(string $name, ?array $data = [])
    • Includes a snip
  • @spread(string $name, int $count || array $datas)
    • Includes a snip multiple times
    • Also adds an $index variable to each iteration

Under the hood the @snip and @endsnip directives just wrap that code in a closure, then @stick and @spread call it. As they're closures they have their own variable scope, but variables defined in the template are included. Names can only contain alpha-numeric characters and underscores.

Sponsoring

This package is completely free to use. However fixing bugs, adding features and helping users takes time and effort. If you find this addon useful and would like to support its development any contribution would be greatly appreciated. Thanks! 🙂

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP Laravel License
0.3.0 ^7.4|^8.0|^8.1|^8.2|^8.3 ^8.0|^9.0|^10.0|^11.0
0.2.0 ^7.4|^8.0|^8.1|^8.2 ^8.0|^9.0|^10.0
0.1.0 ^7.4|^8.0|^8.1 ^8.0|^9.0