Download the PHP package raprmdn/laravel-inertia-datatables without Composer

On this page you can find all versions of the php package raprmdn/laravel-inertia-datatables. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-inertia-datatables

Laravel Inertia Datatables

Latest Version on Packagist

This package is currently in beta. It is usable, but the public API may still change before v1.0.0.

Introduction

raprmdn/laravel-inertia-datatables is a backend-first Laravel query builder for server-side datatables. It supports:

The package does not require Inertia, React, Tailwind, Ziggy, shadcn/ui, or an npm package. Use it with Inertia, API resources, Blade, or any Laravel response.

ColumnDefinition is the primary public API. Define request-facing column keys with Column::make() or Column::group(), enable only needed capabilities, and register them with columnDefinitions().

Installation

Configuration

Optional:

Default configuration:

Quick Start

Define public keys and pass raw request values to the builder. Definitions map those keys to trusted backend columns during make().

Example request:

Unknown filter and sort keys are ignored because they have no matching enabled definition.

Column Definitions

Public Keys and Sources

Column::make() creates one ColumnDefinition:

The first argument is the public request key. The optional second argument is a trusted default backend source.

Do not pass request input as a source. Sources are developer-defined SQL columns or Eloquent relation paths.

Capabilities

Definitions expose only capabilities you enable:

Available capability methods:

Method Enables
searchable() Global search
filterable() Exact, JSON, or custom filtering
sortable() Requested sorting
dateRange() _from and _to date filters

dateRange() enables date filtering directly. It does not require filterable().

Source Overrides

Each capability can override the default source:

Source resolution order:

  1. Capability-specific source
  2. Default source
  3. Public key

Column Groups

Use Column::group() when columns share capabilities:

Associative entries map public keys to backend sources:

Groups expand to independent definitions during registration. A capability source passed to a group is copied to every member; use separate definitions when members need different overrides.

Registration and Merging

Register definitions or groups with columnDefinitions():

Registration is additive. Repeated public keys merge:

Definitions may be registered before or after applyFilters() and applySort(). Resolution happens during make().

Request Resolution

applyFilters() accepts raw column:value strings. applySort() accepts a public key or null:

Filter values split on the first colon, so values may contain more colons. Malformed entries, non-string entries, and unknown public keys are ignored.

Searching

Search reads the configured search query parameter:

Enable search on one definition or a group:

Search behavior:

For Eloquent, dotted sources are relation paths:

For Query Builder, dotted sources are SQL table or alias references.

Filtering

Filters use the configured filters query parameter and column:value format:

Values for one public key are OR-grouped. Different keys are applied as separate AND groups. Values use query bindings.

Filter Aliases

Map friendly request values to backend values:

Aliases are exact and case-sensitive. Unknown values pass through unchanged. Values may be strings, integers, floats, booleans, null, or JSON-compatible arrays.

NULL Values

Exact values NULL and NOT NULL use whereNull() and whereNotNull():

Prefer aliases when exposing these operations to clients.

JSON Filters

Scalar JSON paths normally use exact filtering:

Use jsonContains() for JSON arrays or containment:

Array alias values require jsonContains() or filterUsing(). SQLite supports scalar arrays and object maps; nested arrays need a custom filter because SQLite lacks native structural JSON containment.

Date Ranges

Enable ranges on the public base key:

Clients send _from and _to keys:

Either boundary may be omitted. Empty boundaries are ignored. Dates use the configured Carbon format, defaulting to d-m-Y. Invalid dates throw InvalidArgumentException.

The from boundary starts at midnight and is inclusive. The to boundary is exclusive at the next midnight, preserving the complete selected day including fractional-second timestamps. Comparisons do not wrap the database column in a date function.

An explicitly filterable key such as created_at_from wins before suffix detection.

Custom Filters

Use a trusted callback when exact, relation, JSON, and date filtering are not enough:

filterUsing() selects the strategy but does not enable filtering; also call filterable(). The callback receives the original query and all alias-resolved values for that public key. It runs once during make(), should only add trusted constraints, and should not execute the query. Exceptions propagate.

Keep authorization, tenancy, and visibility constraints in the base query, not in optional datatable filters.

Sorting

Sorting uses the configured column and direction parameters:

Define public sort keys, then pass the requested key to applySort():

Unknown, missing, or null public keys use fallback ordering from orderBy(). The fallback column need not be sortable.

Directions asc and desc are accepted case-insensitively. An invalid request direction uses the fallback direction. The fallback direction itself must be asc or desc; Laravel rejects invalid values during make().

Custom Sorting

Use sortUsing() for calculated values or application-specific ordering:

sortUsing() does not enable sorting; also call sortable(). Callback return values are ignored.

Relations

Column Paths

Eloquent definitions use relation methods followed by the final column:

Search and filtering support nested relation paths. Date ranges also support dotted Eloquent paths.

Relation Sorting

Eloquent sorting supports BelongsTo and HasOne, including nested and self-referencing relations. Sorting uses correlated scalar subqueries, keeps relation constraints and related-model global scopes, and does not join the base query.

HasMany and BelongsToMany sorting is ambiguous and throws InvalidArgumentException. Missing or non-relation methods also fail deterministically. Use sortUsing() when custom aggregation is intentional.

Eager Loading

with() and withCount() accept one relationship or an array:

Repeated calls accumulate. Duplicate plain names are retained once. Laravel count aliases remain valid exact strings.

Constrained definitions are preserved:

A later constrained definition replaces an earlier constraint for the same key. A constrained definition remains authoritative over a plain duplicate.

Pagination & Collections

Pagination

Pagination is the default result type. make() returns a length-aware paginator, appends current request query parameters, and applies the configured link window.

The configured limit request parameter overrides perPage(). The final value is clamped from 1 through pagination.max_per_page.

Collections

Collection output is unpaginated and ignores request and configured page-size behavior. Eloquent returns models; Query Builder returns plain objects.

Search, filters, date ranges, and sorting preserve an existing select(). Relation sorting does not add helper columns or replace selected columns.

Query Builder

Query Builder supports search, exact and custom filters, JSON filters, date ranges, sorting, pagination, and collections. Define columns the same way as for Eloquent.

It does not resolve Eloquent relations. with() and withCount() become no-ops, and dotted search or filter sources are SQL table or alias references.

Supply joins before passing the query to DataTable::query(). Aliases in dotted sources must match query aliases. Qualify overlapping columns and select the base table, such as records.*, to prevent joined values replacing result properties.

For Query Builder sorting only, a multi-part source such as organization.country.name becomes organization_country.name; create that alias yourself. Search and filter sources are used as configured.

API Reference

Column API

Method Purpose
Column::make(string $name, ?string $source = null): ColumnDefinition Create one public-key definition.
Column::group(array $columns): ColumnDefinitionGroup Create a group of independent definitions.
searchable(?string $source = null): self Enable search, optionally overriding its source.
filterable(?string $source = null): self Enable exact, JSON, or custom filtering.
sortable(?string $source = null): self Enable requested sorting.
dateRange(?string $source = null): self Enable _from and _to date filtering.
filterAliases(array $aliases): self Merge exact value aliases.
jsonContains(): self Select JSON containment filtering.
filterUsing(callable $callback): self Select custom filtering; requires filterable().
sortUsing(callable $callback): self Set custom sorting; requires sortable().

Names and sources must not be empty. Invalid definitions throw InvalidArgumentException.

Manager API

Method Purpose
DataTable::query(EloquentBuilder\|QueryBuilder $query): DataTableBuilder Return a fresh builder for the query.

Each query() call returns a new mutable builder, so state does not leak between query chains.

Builder API

Method Purpose
columnDefinitions(array $definitions): self Add definitions and groups.
applyFilters(array $filters): self Replace raw filter expressions.
applySort(?string $sort): self Replace requested public sort key.
with(string\|array $relationships): self Accumulate Eloquent eager loads.
withCount(string\|array $relationships): self Accumulate Eloquent relation counts.
orderBy(string $column = 'created_at', string $direction = 'desc'): self Replace fallback ordering.
perPage(int $limit): self Replace fallback page size.
type(string $type): self Set pagination or collection.
make() Resolve definitions, apply query state, and execute.

Execution order is relations, search, filters, date ranges, sorting, then pagination or collection retrieval.

Request Parameters

Default key Purpose Example
search Global search value ?search=laravel
filters Repeated filter expressions ?filters[]=status:open
col Public sort key ?col=created_at
sort Sort direction ?sort=desc
limit Requested page size ?limit=25

All keys are configurable in inertia-datatables.query_params.

Examples

Example Application (GitHub): https://github.com/raprmdn/laravel-inertia-datatable

Inertia Controller

Inertia is one response option, not a package requirement:

API Resource

Testing

Run package tests:

Equivalent direct command:

For package changes, also validate Composer metadata:

Limitations

Legacy API

Legacy APIs remain fully supported for backward compatibility. New code should use column definitions.

Available legacy methods:

Existing parser flow remains valid:

Legacy allowlists remain required because parser output alone does not authorize SQL columns. Legacy JSON containment paths remain configured through json_columns. Definitions and legacy methods may coexist; legacy setters keep their replacement behavior while columnDefinitions() remains additive.

Contributing

Issues and pull requests are welcome while the package is in beta. Keep changes focused and backend-first. Public API changes require regression tests and README updates.

License

This package is open-sourced software licensed under the MIT license.


All versions of laravel-inertia-datatables with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/pagination Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
nesbot/carbon Version ^2.72|^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package raprmdn/laravel-inertia-datatables contains the following files

Loading the files please wait ...