PHPackages                             advmaker/blade-loop - 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. advmaker/blade-loop

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

advmaker/blade-loop
===================

Extends blade template engine with @loop, @endloop, @break, @continue and in-loop variables

v1.0.0(10y ago)61.2kMITPHPPHP ~5.5|~7.0

Since Apr 13Pushed 9y ago2 watchersCompare

[ Source](https://github.com/advmaker/blade-loop)[ Packagist](https://packagist.org/packages/advmaker/blade-loop)[ Docs](https://github.com/advmaker/blade-loop)[ RSS](/packages/advmaker-blade-loop/feed)WikiDiscussions master Synced 2mo ago

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

blade-loop
==========

[](#blade-loop)

[![Latest Version on Packagist](https://camo.githubusercontent.com/164baf2a2e9375080b44eecbbcef91e1c676c4913426aff24d0daf51b15ffa21/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6164766d616b65722f626c6164652d6c6f6f702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/advmaker/blade-loop)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/994740970c54895aed5f656442ca7a42e2ca79d3291ca2f7022bda333aeb90e6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6164766d616b65722f626c6164652d6c6f6f702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/advmaker/blade-loop)[![Coverage Status](https://camo.githubusercontent.com/907688048b184bb774548782c4e68dd403fdec73b4fe9763d4c1027f9528bc42/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6164766d616b65722f626c6164652d6c6f6f702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/advmaker/blade-loop/code-structure)[![Quality Score](https://camo.githubusercontent.com/3cf9bcf747ce841afccf866ab834fd7b9587c2d6577e6c3f7971930ba55734b4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6164766d616b65722f626c6164652d6c6f6f702e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/advmaker/blade-loop)[![Total Downloads](https://camo.githubusercontent.com/716d32750e340708e24dcf4d73e55834c57b73a9b877717dba4e37e1335ae31d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6164766d616b65722f626c6164652d6c6f6f702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/advmaker/blade-loop)

This package inspired from  but instead of doing multiple things with blade engine (ie: markdown parsing, multiple extensions, etc) it just adds @loop directive to support [twig-like](http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable) loop and loop control directives.

Install
-------

[](#install)

Via Composer

```
$ composer require advmaker/blade-loop
```

And add provider to `config/app.php`

```
'providers' => [
    //...

    Advmaker\BladeLoop\BladeLoopServiceProvider::class,

    //...
]

```

Explanation
-----------

[](#explanation)

By default, before v5.2.12 blade doesn't have `@break` and `@continue` which are useful to have. And before version 5.2.22 it's not supported conditions. So that's included.

Furthermore, the `$loop` variable is introduced inside loops, (almost) exactly like Twig. Description table:

VariableDescription$loop-&gt;index1The current iteration of the loop. (1 indexed)$loop-&gt;indexThe current iteration of the loop. (0 indexed)$loop-&gt;revindex1The number of iterations from the end of the loop (1 indexed)$loop-&gt;revindexThe number of iterations from the end of the loop (0 indexed)$loop-&gt;firstTrue if first iteration$loop-&gt;lastTrue if last iteration$loop-&gt;lengthThe number of items in the sequence$loop-&gt;parentThe parent context> Note: `length`, `last`, `revindex1` and `revindex` variables are only available for PHP arrays, or objects that implement the Countable interface.

Usage
-----

[](#usage)

```
@loop($array as $key => $val)
    {{ $loop->index;}}        {{-- int, zero based --}}
    {{ $loop->index1; }}      {{-- int, starts at 1 --}}
    {{ $loop->revindex; }}    {{-- int --}}
    {{ $loop->revindex1; }}   {{-- int --}}
    {{ $loop->first; }}       {{-- bool --}}
    {{ $loop->last; }}        {{-- bool --}}
    {{ $loop->even; }}        {{-- bool --}}
    {{ $loop->odd; }}         {{-- bool --}}
    {{ $loop->length; }}      {{-- int --}}

    @loop($val as $inner_key => $val)
        {{ $loop->parent->odd; }}
        {{ $loop->parent->index; }}
    @endloop

    @break(false)

    @continue($loop->index === $loop->revindex)
@endloop
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [advmaker](https://github.com/advmaker)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 97.8% 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 ~0 days

Total

2

Last Release

3683d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f30ca95063e7bc41192973106d43189bdb4bdba023e1c858b630bbd832cd853b?d=identicon)[Ellrion](/maintainers/Ellrion)

---

Top Contributors

[![Ellrion](https://avatars.githubusercontent.com/u/1150861?v=4)](https://github.com/Ellrion "Ellrion (44 commits)")[![egolife](https://avatars.githubusercontent.com/u/6567767?v=4)](https://github.com/egolife "egolife (1 commits)")

---

Tags

advmakerblade-loopblade-extensions

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/advmaker-blade-loop/health.svg)

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

###  Alternatives

[rcrowe/twigbridge

Adds the power of Twig to Laravel

9105.9M50](/packages/rcrowe-twigbridge)[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[moonshine/moonshine

Laravel administration panel

1.3k217.1k59](/packages/moonshine-moonshine)[livewire/blaze

A tool for optimizing Blade component performance by folding them into parent templates

688221.3k17](/packages/livewire-blaze)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

703141.0k7](/packages/tallstackui-tallstackui)

PHPackages © 2026

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