Download the PHP package kisame76/filament-db-table-state without Composer

On this page you can find all versions of the php package kisame76/filament-db-table-state. 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 filament-db-table-state

Filament DB Table State

Filament DB Table State

Filament Latest Version on Packagist Tests Total Downloads

Persist Filament table state — filters, sort, search, column order and column visibility — per user in the database, instead of only the session.

Filament can already persist table state with ->persistFiltersInSession(), ->persistSortInSession(), ->persistColumnsInSession() and friends. But the session is per-browser and short-lived: clear cookies, switch device or let the session expire and the state is gone.

This package mirrors that same state into a database row keyed by the user, so a user's filters and column layout survive new sessions and follow them across devices. By default it upgrades every table you already flag with ->persist*InSession(); flip one switch to cover every table.

How it works

Filament writes table state to the session (when the ->persist*InSession() flags are on). This package hooks into Livewire globally and:

  1. Seeds the session from the user's saved DB row on component boot — before Filament's bootedInteractsWithTable() reads it.
  2. Snapshots the session back to the DB at the end of the request — after Filament has written the latest state.

It reuses Filament's own session keys (getTableFiltersSessionKey(), getTableSortSessionKey(), getTableColumnsSessionKey(), …), so it stays compatible with how Filament stores state. Each table gets its own small row per user — keyed by the table's Livewire component class (e.g. App\Filament\Resources\Users\Pages\ListUsers), so rows are easy to identify in the database — holding just that table's state.

Requirements

Installation

Publish and run the migration (creates the table_states table):

The migration adds a user_id foreign key with a cascade delete to your users table. Using UUID/ULID keys or a custom users table? Edit the published migration before running migrate — it has inline comments showing what to change.

That's it. Any table that uses Filament's session persistence (->persistFiltersInSession(), ->persistSortInSession(), ->persistColumnsInSession(), …) now also persists to the database — surviving new sessions and following the user across devices. To enable it for every table automatically, set auto_enable_persistence => true (see below).

Configuration (optional)

Custom user resolution

Need a custom guard or extra scoping? Set a resolver from any service provider's boot():

What persists, and when

The package mirrors whatever Filament writes to the session — it never touches the URL:

Default: opt in for filters, sort & search

Out of the box (auto_enable_persistence => false), turn on Filament's native session persistence for the tables you care about:

Those tables now persist filters and sort to the database as well — surviving new sessions and following the user across devices.

Filament's session-persistence methods

These are the native Filament Table methods this package mirrors to the database. The defaults are Filament's own — note that only the column layout is persisted out of the box:

Method Persists Default
->persistFiltersInSession() Filters off
->persistSortInSession() Sort off
->persistSearchInSession() Table search off
->persistColumnSearchesInSession() Per-column searches off
->persistColumnsInSession() Column visibility + order on

Enable all of them on a single table:

Every method also accepts false to turn it off — handy when auto_enable_persistence is on and you want to exclude one table, e.g. ->persistColumnsInSession(false).

Persist every table automatically

Set auto_enable_persistence => true to flip Filament's session persistence on for every table via Table::configureUsing() — no per-table changes needed.

When this is on, opt a single table back out by chaining the native flags in its table() method — your call wins:

Custom global combinations

auto_enable_persistence => true is a shortcut that turns everything on for every table. For any other global combination — say, persist filters on every table but never persist columns — leave auto_enable_persistence => false and configure Filament yourself in your app's AppServiceProvider::boot():

The package's hook mirrors whatever ends up in the session, so that is all you need: filters now persist to the database everywhere, columns nowhere. Keep auto_enable_persistence => false so the package doesn't flip its own defaults on top of yours.

Turning it off

Set enabled => false to switch the whole package off — no hook, no mirroring.

Notes & caveats

Security

Security reports go to the address in SECURITY.md, never to the issue tracker.

License

MIT — see LICENSE.md.


All versions of filament-db-table-state with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^4.3|^5.0
illuminate/contracts Version ^11.0|^12.0|^13.0
livewire/livewire Version ^3.5|^4.0
spatie/laravel-package-tools Version ^1.16
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 kisame76/filament-db-table-state contains the following files

Loading the files please wait ...