Download the PHP package andreazorzi/search-table without Composer
On this page you can find all versions of the php package andreazorzi/search-table. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andreazorzi/search-table
More information about andreazorzi/search-table
Files in andreazorzi/search-table
Package search-table
Short Description Easy to use models table
License MIT
Homepage https://github.com/andreazorzi/search-table
Informations about the package search-table
SearchTable
A Laravel package that adds dynamic data tables to Eloquent models with filtering, sorting, and customizable action buttons. Built with Bootstrap 5 and htmx for seamless, modern web applications.
What This Package Does
This package transforms your Eloquent models into powerful, interactive data tables with:
- Dynamic Data Tables - Automatically generate tables from your models
- Advanced Filtering - Search and filter data with multiple criteria
- Sorting Capabilities - Sort by any column with ascending/descending options
- Customizable Actions - Add custom action buttons for each row
- Real-time Updates - htmx-powered interactions without page reloads
- Bootstrap 5 Styling - Modern, responsive UI components
All tables are fully responsive and provide a seamless user experience with instant filtering and sorting.
Requirements
Frontend Dependencies
This package assumes you have the following assets available in your project:
- Bootstrap 5 - for styling the generated tables and UI components
- htmx - for handling AJAX requests and seamless interactions
Installation
1) ### Install the package:
2) ### Install frontend dependencies (if not already installed):
Setup
Controller Configuration
Add the SearchController trait to any model controller you need to be searchable:
Model Configuration
Add the SearchModel trait and configure the $table_fields variable in your model:
Usage
Basic Implementation
Include the SearchTable component in your Blade views:
Component Parameters
| Parameter | Type | Description |
|---|---|---|
query |
string | Initialize the table with a simple filter (non persistent) |
advanced |
array | Initialize the table with advanced filters (non persistent) |
modelfilter |
array | Initialize the table with persistent filters |
page |
integer | Initialize the table to the desired page |
limit |
integer | Set the table entries limit |
size |
integer | Set the table size (Bootstrap column size) |
addRedirect |
string | Add a redirect link on the add button |
disableaddbutton |
boolean | Disable or enable the add button |
disablesearchbar |
boolean | Disable or enable the search bar |
disabletotalrow |
boolean | Disable or enable the totals row |
showadvancefilters |
boolean | Enable or disable the advanced filters |
fit |
boolean | Enable or disable the column fit style |
Example with Parameters
Configuration
Table Fields Configuration
The $table_fields array defines how each model attribute should be displayed and behave in the table:
Basic Parameters
| Parameter | Description | Example |
|---|---|---|
sort |
Default sort direction (asc or desc) |
"sort" => "asc" |
filter |
Enable filtering for this column | "filter" => true |
hidden |
Hide column but keep it sortable | "hidden" => true |
Customization Parameters
| Parameter | Description | Example |
|---|---|---|
custom-label |
Custom header label | "custom-label" => "Full Name" |
custom-value |
Method name for custom value display | "custom-value" => "getFullName" |
custom-filter |
SQL for custom filtering | "custom-filter" => "CONCAT(first_name, ' ', last_name)" |
advanced-type |
Define the custom filter evaluating method | "custom-filter" => "CONCAT(first_name, ' ', last_name)" |
Custom filters attribute example
Advanced Filter Types
| Type | Description | Usage |
|---|---|---|
date-range |
Date range filtering | "advanced-type" => "date-range" |
in-array |
Comma-separated values | "advanced-type" => "in-array" |
like |
LIKE pattern matching | "advanced-type" => "like" |
Example: Complete Field Configuration
Advanced Features
Advanced Filters
Create custom advanced filters by adding a Blade file at:
resources/views/components/search-table-filters/[model-name]-filters.blade.php
The example below use Selectize for manage the multiple select.
Custom Action Buttons
Define custom actions for each table row:
Excample
Simple User Table
Advanced Product Table with Relationships
The MIT License (MIT)
Copyright © 2025 Andrea Zorzi [email protected]
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
All versions of search-table with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/support Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
maatwebsite/excel Version ^4.0