Download the PHP package acunsoft/datatable-laravel without Composer

On this page you can find all versions of the php package acunsoft/datatable-laravel. 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 datatable-laravel

acunsoft/datatable-laravel

Server side for Acun DataTable, for Laravel and Livewire in one package:

It is general-purpose: it needs Laravel 12 or 13 and PHP 8.2+, nothing else. Livewire 4 is only needed for the Livewire table. No CSS framework or UI kit is required.

JSON endpoint

The browser side, in one call with @acunsoft/datatable:

or createHttpDataSource({ url: '/orders/data' }) with the separate packages. The query is read from the URL for GET and from the form or JSON body for POST (register the route with Route::match(['get', 'post'], …); POST needs the CSRF token, which AcunDataTable sends from <meta name="csrf-token">).

An existing DataTables front end works too. A request in DataTables' server-side protocol (it carries draw) is read as such — start/length, order[i][column|dir] by column index, columns[i][search][value] as a contains filter, search[value], length=-1 as the largest page allowed — and answered with { draw, recordsTotal, recordsFiltered, data }; an invalid request gets DataTables' error (with a 200, as DataTables expects). The same column allowlist and limits apply. So a page still on DataTables can move its endpoint to TableResponse first and its front end later.

Livewire table

What you get:

Column visibility

A "Columns" menu (native <details>, one checkbox per column) lets users hide columns; the hidden IDs are kept in the URL (hidden[]=note).

Hidden columns still sort, filter and search. Unknown or protected IDs in the URL are ignored, and at least one column always stays visible.

Row and bulk actions

->icon('edit') (or 'view', 'delete', 'copy', 'check', 'download', or SVG path data), ->icon('view', only: true) for an icon button, ->danger() for destructive actions; maxInlineActions() keeps the first actions in the row and moves the rest into a "⋮" menu. Shift+click on a row checkbox selects a range (selectRange()).

Layout, pagination and the tools menu

The table sits between two bars, like DataTables: page size and search top left, the column menu and the tools menu top right, the row range (Toplam: 5.000 kaydın 1 ile 25 arasını gösteriyor) bottom left and numbered pages bottom right (‹ 1 … 4 5 6 … 200 ›, with the current page marked aria-current="page"). Return only the slots you want to change from tableLayout():

Filter panel. ->filter() puts a column in the "Filters" menu with a control for its type (text, min–max, from–to, yes/no); ->options([...]) gives ticks instead. Active filters show as removable chips above the table; your own buttons can call filterBy('status', ['selected' => ['paid']]), clearPanelFilters() clears the panel's filters and keeps the others.

The fields open under the button by default; filterPanel() opens them in a drawer from the right (drawer, full width on phones) or a centred dialog (modal): a native <dialog>, closed with Escape, the backdrop or "Close". For a drawer or modal of your own, leave filters out of tableLayout() and include only the fields in your own layout feature view:

Toolbar buttons. toolbarButtons() sets the text, icon, icon-only look and classes of the columns, filters and tools buttons; icon is a built-in name, SVG path data or false, and your classes (e.g. Bootstrap's) win over the package's :where() styles. Below 640px these buttons show only their icon.

Rows per page. pageSizeOptions() sets the choices of the select and defaultPageSize() the size at the start (default 25, or the first option); pageSize stays in the URL only while it differs from the default.

Header and sorting. stickyHeader() keeps the header at the top of the window while the page scrolls (DataTables fixedHeader; under a fixed top bar set --adt-sticky-top: 64px), scrollY() gives the table a fixed height that scrolls inside with the header in place ('60vh'), and multiSort() returning false makes Shift+click sort by one column only.

Narrow screens and sizes. Choose how the table behaves on phones and how dense it is:

cards turns every row into a card, scroll keeps the table and scrolls it sideways, collapse hides lower-priority columns behind a ⊕ button that opens their values below the row (DataTables Responsive style), and modal opens every value of the row, with its actions, in a native <dialog> (Escape, ✕ or a click outside closes it). The button only appears while columns are hidden.

Every text can be changed for one table with texts(), by the keys of the package's language file, for example a noun that fits the rows (Turkish suffixes cannot be generated, so give the whole sentence):

For every table at once, publish the language files (php artisan vendor:publish --tag=acun-datatable-lang) or put the keys in lang/vendor/acun-datatable/{locale}/table.php.

Features are pageSize, search, columns, tools, info and paging; any other name is included as a Blade view with the table's variables ($rows, $columns, and $this for the component), so filter buttons or a "New" link fit into the bars. The pager keeps the same number of buttons as you move, so it never jumps in width; with a "10,000+" total it numbers the pages known to exist and stops at the result window.

The tools menu holds everything that is not about the rows on screen: export (exportFormats()), print (printable(): only the table with the rows on screen, not the page around it) and import (WithTableImport). It only appears when at least one of them is on.

Editing in place

The cell gets an edit button (and a double click) with an editor for its type; Enter or leaving the field calls updateCell(). On the server the row is looked up inside query(), the model's policy must allow update (when it has one), and the value is validated against the type, options() and your rules (nullable unless required; a decimal comma is accepted); an error keeps the editor open with the message. saveCell() then sets only that column's attribute and saves the model; override it for query-builder rows or extra logic, and authorizeEdit() for other checks.

Resizing and moving columns

Widths and order are component state ($columnWidths, $columnOrder), read back through validation (known columns only, 48–2000 px). A resize sends the widths once, when the drag ends; the first one fixes every column at its current width so nothing else jumps. "Reset columns" in the column menu restores both.

Fixed columns

The cells stay in place while the table scrolls sideways (responsive() scroll, or a wide table). Offsets are measured in the browser with Alpine and follow every update; on a phone pinned cells never take more than 60% of the width.

Lazy loading

A lazy table (#[Lazy], or <livewire:orders-table lazy />) renders the page first and loads itself once it scrolls into view. Meanwhile the trait's placeholder() shows the header and shimmering placeholder rows, so the page does not jump; define your own placeholder() to replace it. During later updates the current rows stay, dimmed, with aria-busy.

Child rows

Every row gets a ⊕ button that opens the view below it (DataTables child rows; in the dialog with responsive() modal, after the row's values). The view is rendered only for open rows, once the button is pressed, so it can load relations or run queries for that row alone; "Loading…" shows meanwhile. Only rows of the current page open (toggleDetail($key)).

Footer totals

A <tfoot> row shows the total over every row matching the search and filters, computed in one SQL query (SUM, AVG, …) next to the count. It is left out while the count is only "10,000+", since a total of an unknown number of rows would cost what the count saved. The JSON endpoint sends the same values as totals, which the browser packages show. A column's format() also formats its total, with $row null; a formatter that needs the row falls back to the default text.

Export and import

The export items download the visible columns of every row matching the current search, filters and sorting (or only the selected rows when there is a selection), read in chunks on the server. Up to exportLimit() rows (100,000); beyond that the user is asked to narrow the filters. See TableExport below.

Large exports and bulk actions in the queue

An export past exportLimit() (or a queued() bulk action) goes to a job, RunTableTask, and the table says so while you keep working. The job rebuilds the table from its state (search, filters, sorting, selection) as the user who started it, so query() and policies see the same user (and the worker forgets that user afterwards). When the file is ready the table shows "Download": a signed link valid for an hour, only for that user (a guest's task belongs to the guest's session), and the file is deleted once sent. A table runs one task at a time, and one visitor may start queuedTaskLimit() tasks (10) per 10 minutes. Tasks belong to the request's auth guard; taskGuard() names another. A failure shows a generic message (the details go to your log). Run a queue worker, and schedule php artisan acun-datatable:prune daily for files nobody downloaded.

WithTableImport adds "Import…" to the tools menu: it opens the file picker, and once a file is chosen a panel above the table shows its name with "Import" and "Close" (.xlsx or .csv, 10 MB by default). The file is read with limits, every value is converted to its column's type (Turkish 1.234,50 and 23.10.2026 with the tr locale), and only valid rows reach importRow(), all in one database transaction: an exception stores nothing. Problems are listed with their line ("Satır 3 · Tutar · “abc”: geçerli bir ondalık sayı değeri değil").

Safety. All state from the browser is treated as untrusted. URL state that does not fit the columns (unknown or non-sortable fields, bad values, a page size that is not an option, a page past the end) is dropped or corrected instead of failing the page. Selected keys are only looked up inside query(), so a forged key cannot reach rows outside it; "all matching" and the excluded keys are #[Locked]. Helper methods are protected, so the browser can only call the actions listed above (plus runRowAction and runBulkAction, which only run actions you declared). Authorize in query() or mount() as usual.

Markup and styling. The view is plain Blade with the class names of @acunsoft/datatable-dom (adt-table, adt-sort, adt-paging, …), so its optional stylesheet styles both, including the responsive layout, dark mode and the --adt-* custom properties for your colours, radii and density. The menus close with Escape or a click outside (Alpine, which Livewire ships). Include it from npm (@acunsoft/datatable-dom/styles.css) or style the classes yourself. To change the markup, publish the views (table, bar, feature, import):

or give your component its own render() and @include('acun-datatable::livewire.table') inside your layout. Override caption(), pageSizeOptions(), maxSelected() (explicit keys, default 1000), rowLabel($row) (the checkbox name for screen readers, default the first column's text) and keyName() (query-builder tables) as needed.

Columns are the allowlist

Column::make($id) declares what a client may use; nothing else reaches SQL.

Method Meaning
column('created_at') database column (default: the ID); a plain identifier, set by you, never by the request
type('decimal') text, number, decimal, date (a calendar day), datetime (an instant), boolean
sortable() / filterable() allow sorting / filtering; filterable columns are also searchable
searchable(false) keep a filterable column out of the global search
searchUsing('customer_search') match search and contains/startsWith against a folded copy (see below)
header('Müşteri') display text (used by the Livewire views)
format(fn ($value, $row) => '…') cell text in the Livewire views (plain text, escaped)
hideable(false) / hidden() Livewire column menu: never hidden / hidden at first
view('orders.status-badge') Livewire cell rendered by your Blade view ($row, $value, $text, $column), e.g. a badge or an avatar; exports keep the text
priority(1) narrow screens with responsive() collapse / modal: 1 always, 2 below 640px, 3 below 960px; with auto, the order columns hide in when they do not fit

Unknown, undeclared or not-allowed fields and malformed values throw InvalidTableQuery; TableResponse answers HTTP 422 { message, errors }.

Query rules (same as the browser)

Turkish and accent-insensitive search

Search and contains / startsWith ignore case, accents and the Turkish dotted/dotless i on every database, like the browser (Text::fold: İSTANBUL, Iğdır, Ayşe → istanbul, igdir, ayse): istanbul finds İstanbul, IGDIR finds Iğdır. The column is folded in SQL (a registered PHP function on SQLite, LOWER/REPLACE on MySQL, PostgreSQL and SQL Server); the text as typed is matched too, so the database collation still helps with letters outside the Turkish, German, French and Spanish ones.

That fold runs for every row of every search. On large tables, store a folded copy once and point the column at it; it is then a plain LIKE, and startsWith can use an index:

Large tables (millions of rows)

The browser only ever holds one page, so table size is a database question. What these defaults did in one measurement — medians on 5,000,000 rows in PostgreSQL 17 (Apple M2, 25 rows per page, count + page). Other tables, filters, indexes and databases give other numbers; measure yours (bench/ in the repository):

One request (count + page) Before 0.3 0.3 defaults + recommended indexes
First page, sorted by date 52.8 ms 1.4 ms 1.1 ms
One month of dates 373.3 ms 1.7 ms 1.7 ms
Status filter, sorted by amount 27.9 ms 1.3 ms 1.4 ms
Search "ayse" 3,480 ms 79.4 ms 22.4 ms
Search "istanbul" 3,497 ms 42.3 ms 13.2 ms
Search "ayse istanbul" 3,737 ms 824.6 ms 68.2 ms
Search with no match > 2,413 ms 2,170 ms 0.4 ms
Page 2,000 136.8 ms 82.1 ms 79.6 ms
Page 100,000 4,199 ms refused (result window) refused; cursor paging: 55.5 ms

"Recommended indexes": a folded copy of each searchable text column with a GIN trigram index (step 2 below).

What the package does for you:

What you do:

  1. Index what users sort and filter by, together with the key: $table->index(['ordered_at', 'id']); $table->index(['status', 'id']); Only mark indexed columns sortable(). For filters that are used together, add one index with the equality column first and the range column after it: $table->index(['status', 'ordered_at', 'id']); On 5M rows, "paid in the last month" then counts from the index alone: 1,373 ms → 19 ms per request. Check slow combinations with EXPLAIN ANALYZE.
  2. Searchable text: a folded copy plus a trigram index. %term% cannot use a normal index, and folding in SQL costs time on every row. Store the folded text once and index it:

    On MySQL use a FULLTEXT index with the ngram parser, or a search engine. Add the column before loading data. On an existing large table do not fill it with one UPDATE: that rewrites every row in every index (it ran for hours on 5M rows). Build a new table with CREATE TABLE … AS SELECT and swap it in (37 s for 5M rows), or update in batches by primary key.

  3. Beyond a few million searchable rows, use a search engine (Meilisearch, Typesense or OpenSearch through Laravel Scout) for the text search, and keep filters, sorting and paging in the database:

    The engine is asked once per request and only for a search; its keys then limit the rows (whereKey) for the page, the count, footer totals, bulk actions and exports alike, inside query() and the filters. The package does not depend on Scout: any function that returns keys works.

Export on the server: TableExport

Import with the import dialog: TableImport

The import dialog of @acunsoft/datatable-import (file and drag and drop, column mapping with a preview, progress, results, error report) talks to your back end by the import protocol acun-import/1. TableImport is that back end for one kind of record — or write your own; the dialog does not mind.

On a Livewire table, importEndpoint() adds "Import…" to the tools menu, which opens the dialog (load acun-datatable-import.min.js and its styles.css on the page); the table is refreshed when rows changed:

What it does for you — everything the protocol asks of a back end:

Import on the server: SheetReader and RowImporter

SheetReader reads CSV (delimiter detection, quotes, BOM; non-UTF-8 files as Windows-1254, as Turkish Excel writes them) and xlsx (shared strings, dates, 1904 dates, cached formula results; never evaluates formulas), with limits on file size, rows, columns, archive entries and inflated entry size (counted while reading). Errors are ImportExceptions with a translated message.

For large files, stream() reads the same rows with the same checks but gives the headers at once and the rows in chunks, reading the file (and an xlsx worksheet as it inflates) piece by piece, so memory follows the chunk, not the file; TableImport reads uploads this way:

Using the parts directly

Upgrading

From 0.4: see UPGRADING.md (re-publish customized views, the user's sort now comes first).

Tests

PHPUnit + Orchestra Testbench on SQLite, with the same folding and search-splitting vectors as the TypeScript core, and Livewire component tests for sorting, filters, tampered URL state, selection scope and escaping.

License

MIT. Provided “as is”, without warranty of any kind; the authors and Acunsoft accept no liability for any damage or data loss arising from its use (see LICENSE).


All versions of datatable-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/database Version ^12.0 || ^13.0
illuminate/http Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
illuminate/view Version ^12.0 || ^13.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 acunsoft/datatable-laravel contains the following files

Loading the files please wait ...