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

Grid Laravel Package

sylius/grid

Sylius Grid component adds a reusable, configurable grid system for Symfony apps. Define grids in configuration, plug in data providers and drivers, then render sortable, filterable tables with pagination and actions—ideal for admin panels and back-office listings.

View on GitHub
Deep Wiki
Context7

[READ-ONLY] Generic Grid component that allows you to manage fields, sorting, filters and actions for grids of data.

Frequently asked questions about Grid
How do I integrate sylius/grid into a Laravel project for an admin panel?
Start by installing via Composer (`composer require sylius/grid`), then register the `GridFactory` as a service provider in `config/app.php`. Define your grid configuration in YAML/XML/PHP arrays, bind data sources (e.g., Eloquent repositories), and render grids in Blade using `{{ grid('YourGridName') }}`. The package works seamlessly with Laravel’s service container and Eloquent.
Does sylius/grid support Laravel’s Eloquent ORM for data sources?
Yes, sylius/grid fully supports Eloquent repositories or raw queries as data sources. Configure your grid to use a repository (e.g., `$gridFactory->createGrid('ProductGrid', ['data_source' => $productRepository])`), and it will handle pagination, sorting, and filtering via Eloquent’s query builder. Just ensure your repository returns a `Collection` or `Builder` instance.
Can I use sylius/grid with Livewire or Alpine.js for dynamic filtering?
While sylius/grid itself isn’t reactive, you can pair it with Livewire or Alpine.js for dynamic updates. Use Livewire’s `$emit` or Alpine.js to trigger grid re-renders when filters change, or leverage Laravel’s Form Requests to validate and apply filters server-side. The grid’s configuration-driven approach makes this integration straightforward.
What Laravel versions does sylius/grid support?
sylius/grid is framework-agnostic but aligns with Symfony’s ecosystem, which Laravel shares. It works with Laravel 8+ (PHP 8.0+) and Symfony 5.4+. For Laravel 7 or PHP 7.x, check the package’s [release notes](https://github.com/Sylius/Grid/releases) for compatibility patches, as newer versions may require PHP 8.0+ features like named arguments.
How do I customize field types or add filters beyond the defaults?
sylius/grid supports custom field types and filters via plugins. Extend the `FieldTypeInterface` or `FilterTypeInterface` and register your custom type in the grid configuration. For example, add a `RichTextFieldType` by defining it in your grid’s `fields` array with a custom class. The [documentation](http://docs.sylius.com/en/latest/components_and_bundles/components/Grid/index.html) provides examples for common extensions.
Will sylius/grid work with large datasets (e.g., 50K+ records)?
sylius/grid handles large datasets efficiently if configured properly. Use paginated data sources (e.g., `->paginate(50)`) and ensure your database queries are optimized (e.g., indexed columns for sorting/filtering). For extreme scale, consider database-level filtering (e.g., `WHERE` clauses in raw SQL) or caching grid configurations. Test with your expected dataset size to validate performance.
Is there built-in caching for grid configurations or query results?
sylius/grid does not include built-in caching, but you can implement it manually. Cache grid configurations (e.g., YAML/PHP arrays) using Laravel’s cache facade (`Cache::remember`). For query results, cache the paginated `Collection` or use database-level caching (e.g., Redis with `->remember()`). This is especially useful for public dashboards or read-heavy admin panels.
How do I test sylius/grid in Laravel’s testing environment?
Test grids by mocking their data sources and asserting rendered output. Use Laravel’s `Http::fake()` to test Blade rendering or `GridTestCase` (if available in Sylius’s test suite). Focus on edge cases like empty results, malformed filters, and pagination boundaries. Example: `$grid = $gridFactory->createGrid('TestGrid', ['data_source' => $mockRepository]); $this->assertCount(10, $grid->getResults());`
Are there alternatives to sylius/grid for Laravel admin grids?
Yes, alternatives include `spatie/laravel-data-grid` (simpler, Laravel-specific), `backpack/grid` (for Backpack CMS), or `filamentphp/filament` (for Filament admin panels). sylius/grid stands out for its modularity and Symfony integration, making it ideal if you need deep customization or work with Sylius. Choose based on your need for flexibility (sylius/grid) vs. quick setup (spatie/laravel-data-grid).
How do I add bulk actions (e.g., select-all, batch delete) to a grid?
sylius/grid supports actions via the `actions` configuration key. Define bulk actions like `['delete' => ['type' => 'delete', 'label' => 'Delete Selected']]` and handle the logic in a controller or repository. Use Laravel’s Form Requests to validate bulk operations. For select-all functionality, add a checkbox field and pass selected IDs via hidden inputs or JavaScript (e.g., Alpine.js).
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
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