PHPackages                             jacksleight/blade-snip - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. jacksleight/blade-snip

ActiveLibrary[Templating &amp; Views](/categories/templating)

jacksleight/blade-snip
======================

0.3.0(2y ago)2076PHPPHP ^7.4|^8.0|^8.1|^8.2|^8.3

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jacksleight/blade-snip)[ Packagist](https://packagist.org/packages/jacksleight/blade-snip)[ RSS](/packages/jacksleight-blade-snip/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

[![Packagist version](https://camo.githubusercontent.com/4c01e7515afc4a252ce868c471b51aecc40d51e911053f5dd77e5d5818814701/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6a61636b736c65696768742f626c6164652d736e6970)](https://camo.githubusercontent.com/4c01e7515afc4a252ce868c471b51aecc40d51e911053f5dd77e5d5818814701/68747470733a2f2f666c61742e62616467656e2e6e65742f7061636b61676973742f762f6a61636b736c65696768742f626c6164652d736e6970)[![License](https://camo.githubusercontent.com/9261a7a3cefd28e28ea28081c15d83fd9ac748b05de6a9ada97fef2effdbbc5c/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f6c6963656e73652f6a61636b736c65696768742f626c6164652d736e6970)](https://camo.githubusercontent.com/9261a7a3cefd28e28ea28081c15d83fd9ac748b05de6a9ada97fef2effdbbc5c/68747470733a2f2f666c61742e62616467656e2e6e65742f6769746875622f6c6963656e73652f6a61636b736c65696768742f626c6164652d736e6970)

Blade Snip
==========

[](#blade-snip)

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

```

    @snip('product', ['image' => null])

            @if ($image)

            @endif
            Lorem Ipsum Dolor
            £{{ number_format($price ?? rand(10, 100)) }}
            Add to Basket

    @endsnip
    @stick('product')
    @stick('product', ['image' => 'cheese.jpg'])
    @stick('product', ['image' => 'potato.jpg', 'price' => 120])
    {{-- or --}}
    @spread('product', 3)

```

```
@snip('content')

@endsnip
@if ($link)
    @stick('content')
@else
    @stick('content')
@endif
```

```
@snip('complex_thing')
    ...
@endsnip

    {{ $name }}
    {{ $location }}
    @stick('complex_thing')

        {{ $name }}
        {{ $location }}
        @stick('complex_thing')

```

Why?
----

[](#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
------------

[](#installation)

Run the following command from your project root:

```
composer require jacksleight/blade-snip
```

Usage
-----

[](#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
----------

[](#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](https://github.com/sponsors/jacksleight) would be greatly appreciated. Thanks! 🙂

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~378 days

Total

3

Last Release

826d ago

PHP version history (3 changes)0.1.0PHP ^7.4|^8.0|^8.1

0.2.0PHP ^7.4|^8.0|^8.1|^8.2

0.3.0PHP ^7.4|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/126740?v=4)[Jack Sleight](/maintainers/jacksleight)[@jacksleight](https://github.com/jacksleight)

---

Top Contributors

[![jacksleight](https://avatars.githubusercontent.com/u/126740?v=4)](https://github.com/jacksleight "jacksleight (75 commits)")

### Embed Badge

![Health badge](/badges/jacksleight-blade-snip/health.svg)

```
[![Health](https://phpackages.com/badges/jacksleight-blade-snip/health.svg)](https://phpackages.com/packages/jacksleight-blade-snip)
```

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3416.6k](/packages/duncanmcclean-statamic-cargo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
