Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twig List Loop

Twig List Loop Laravel Package

aaronadal/twig-list-loop

Twig extension that adds a “list” tag to build reusable list/table/grid skeletons. Render items into a shared template via “using”, with access to loop plus list/else variables and optional inline if filters, similar to Twig’s for loop.

View on GitHub
Deep Wiki
Context7

A different way to display lists, grids and tables in Twig: the list loop.

Frequently asked questions about Twig List Loop
Can I use this package with Laravel Blade templates?
No, this package is Twig-only. If you’re using Blade, you’ll need to integrate Twig (e.g., via `crabbly/laravel-twig`) and migrate those templates to Twig first. It’s not designed for hybrid Blade-Twig workflows.
What Laravel versions does this package support?
The package itself doesn’t enforce Laravel version constraints, but it requires Twig (last updated in 2019), which may conflict with modern Laravel (9.x+) or PHP 8.1+. Test thoroughly for compatibility.
How do I install and configure this in Laravel?
Run `composer require aaronadal/twig-list-loop`, then register the Twig extension in your Twig environment (e.g., via `crabbly/laravel-twig`). No additional Laravel service provider is needed—it’s purely a Twig extension.
Will this work with Laravel Livewire or Alpine.js for dynamic updates?
Yes, but ensure your Twig templates are properly integrated with Livewire/Alpine. The package handles rendering logic; dynamic behavior (e.g., AJAX updates) depends on your frontend setup. Test edge cases like nested loops.
Are there performance concerns with nested list tags?
Nested tags may introduce rendering overhead, especially with complex skeletons. Avoid excessive nesting (e.g., >3 levels) to prevent stack overflows. Cache skeletons with Twig’s `{% cache %}` if performance is critical.
How does this compare to Blade’s `@component` directives?
This package offers Twig-specific syntax for reusable lists/tables, while Blade’s `@component` is more generic. If you’re migrating from Blade, `@component` might feel more familiar, but this package excels for Twig-centric apps with repetitive table/grid structures.
Does this support Laravel Eloquent models or Collections?
No, it works with raw data passed to Twig. You’ll need to pre-process Eloquent models/Collections into arrays or objects before passing them to the `list` tag. Example: `{% list user in users|keys %}`.
How do I handle empty lists or fallback content?
Use the `else` variable in your skeleton template. The package passes rendered `else` content to the `else` variable, letting you conditionally display placeholders (e.g., `<p>No records found</p>`).
Is this package actively maintained? What if Twig v3+ breaks compatibility?
The package hasn’t been updated since 2019, so Twig v3+ or PHP 8.1+ may introduce issues. Check the GitHub issues for open compatibility reports. Consider forking or alternatives if maintenance is a concern.
Can I use this for public-facing grids (e.g., DataTables integration)?
Yes, but ensure your skeleton template supports client-side libraries like DataTables. The package handles server-side rendering; client-side interactivity (e.g., sorting, pagination) must be implemented separately via JavaScript.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views