radic/blade-extensions
radic/blade-extensions is a collection of practical custom directives that extend Laravel's Blade templating engine. It adds convenient helpers for variable assignment, loop control, and common view tasks, letting you keep templates cleaner and more expressive without writing extra PHP.
@foreach with Twig-style loop metadata, @break, @continue, @set, @array). Each directive is a handful of lines behind Blade::directive(). That makes it a useful reference implementation for a build-vs-buy conversation, where "buy" costs a dependency and "build" costs an afternoon.$i++, $loop->last equivalents, or array_key_first() in views, this package names the problem and gives a vocabulary to standardize on ("loop metadata is available; don't write manual counters").$loop in 5.3, @break/@continue, @php superseding @set), the package is a marker of legacy code worth scheduling for removal before/alongside a Laravel upgrade.Consider it when:
$loop metadata does not exist and retrofitting controllers is out of scope.loop.index / loop.first / loop.last mental model reduces onboarding and review friction.Look elsewhere — or copy the directive implementations in-house — when:
$loop is native, and especially 5.5+, where @php, @break, and @continue leave only @set and @array as residual value. The value proposition collapses to convenience.For executives (one paragraph): This is a small, MIT-licensed, zero-cost Blade helper that makes templates slightly nicer to write — loop counters, early exits, inline array literals. It is a developer-ergonomics item, not a platform or architecture decision, and it carries no licensing cost. The strategic read is more interesting than the tool: its headline feature was subsequently absorbed into the Laravel framework itself, and the package has no downstream dependents. That tells us to treat it as an idea source rather than a foundation, and to avoid putting roadmap weight on it. If we adopt it at all, we do so with an exit plan that costs roughly one engineer-day.
For engineering (decision framing): Two viable options.
@set, @array, or loop metadata on an older Laravel. Budget a removal ticket at the same time — the dependency is thin and the semantics are replicable, so the exit cost is low.AppServiceProvider via Blade::directive(). Zero dependency, full control, testable, upgrade-safe. For anything with a horizon beyond one release cycle, this is the recommended path — it captures all the ergonomic value and none of the maintenance risk.In both cases, the genuinely useful output is the convention: publish a short internal standard stating that loop metadata is available, manual index counters are discouraged, and template-side mutation should be exceptional and reviewable. The package is a credible citation for that standard even if the code never ships.
How can I help you explore Laravel packages today?