milenmk/laravel-simple-datatables-and-forms

Simple Table component to create datatables for Livewire components

2.1.4 2025-08-16 21:47 UTC

README

A lightweight, easy-to-use Laravel package for creating interactive data tables and dynamic forms with Livewire integration.

Screenshot Screenshot

Overview

Laravel Simple Datatables And Forms provides two powerful components for your Laravel applications:

๐Ÿ“Š Data Tables

Create interactive, feature-rich data tables with minimal code. Includes advanced search, sorting, filtering, grouping, and export capabilities.

๐Ÿ“ Dynamic Forms

Build dynamic forms with fluent API, multiple field types, validation, and model binding support.

Key Features

  • ๐Ÿ” Advanced Search - Debounced search with minimum character requirements
  • ๐Ÿ”„ Column Sorting - Click-to-sort functionality for table columns
  • ๐Ÿงน Filtering & Grouping - Multiple filter types with advanced grouping options
  • ๐Ÿ“ค Data Export - Export to CSV, Excel, and PDF formats
  • ๐Ÿ“ Dynamic Forms - Fluent features for building complex forms
  • ๐Ÿ”ง Multiple Field Types - Input, Select, Checkbox, Toggle, Textarea, and more
  • โœ… Validation Integration - Built-in Laravel validation support
  • ๐Ÿ“ฑ Responsive Design - Mobile-friendly components
  • โšก Performance Optimized - Intelligent caching and query optimization
  • ๐Ÿ”’ Security Features - CSRF protection and input sanitization
  • ๐Ÿงฉ Seamless Livewire Integration - Built specifically for Livewire 3.x

Requirements

  • PHP 8.2 or higher (compatible with PHP 8.3 and 8.4)
  • Laravel 10.x or higher (compatible with Laravel 11.x and 12.x)
  • Livewire 3.x or higher

Quick Start

Installation

composer require milenmk/laravel-simple-datatables-and-forms

Publish Configurations

php artisan vendor:publish --tag=laravel-simple-datatables-and-forms-config

Publish Assets

php artisan simple-datatables-and-forms:publish-assets

Include Assets in Your Layout

<head>
    @SimpleDatatablesStyle
</head>
<body>
    <!-- Your content -->
    @SimpleDatatablesScript
</body>

Create Your First Data Table

Generate a table component:

php artisan make:milenmk-datatable UserList User --generate

Or create manually:

use Milenmk\LaravelSimpleDatatablesAndForms\Traits\HasTable;

class UserList extends Component
{
    use HasTable;

    public function table(Table $table): Table
    {
        return $table
            ->query(User::query())
            ->schema([
                TextColumn::make('name')->searchable()->sortable(),
                TextColumn::make('email')->searchable(),
                ToggleColumn::make('is_active')->label('Active'),
            ])
            ->striped()
            ->paginate();
    }
}

Create Your First Form

Generate a form component:

php artisan make:milenmk-form CreateUser create User --generate

Or create manually:

use Milenmk\LaravelSimpleDatatablesAndForms\Traits\HasForm;

class CreateUser extends Component
{
    use HasForm;

    public function form(Form $form): Form
    {
        return $form->model(User::class)->schema([
            InputField::make('name')->required(),
            InputField::make('email')->email()->required(),
            SelectField::make('role')
                ->options(['admin' => 'Admin', 'user' => 'User'])
                ->required(),
        ]);
    }
}

Documentation

๐Ÿ“š Complete Documentation

๐Ÿ“Š Data Tables Documentation

๐Ÿ“ Forms Documentation

Tailwind CSS Integration

Add the package views to your Tailwind configuration:

// tailwind.config.js
module.exports = {
    content: [
        // ... your existing content paths
        './vendor/milenmk/laravel-simple-datatables-and-forms/resources/views/**/*.blade.php',
    ],
    // ... rest of your configuration
};

Contributing

Contributions are welcome! Please visit our GitHub repository to:

  • Report bugs or request features
  • Submit pull requests
  • Browse existing issues
  • Join discussions

Support

License

This package is licensed under the MIT License. See the LICENSE file for more details.

Disclaimer

This package is provided "as is", without warranty of any kind. Please thoroughly test in your environment before deploying to production.