Download the PHP package androsamp/filament-resource-lock without Composer

On this page you can find all versions of the php package androsamp/filament-resource-lock. 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-resource-lock

Filament Resource Lock

Record-level locking for Filament v5 edit pages with optional audit history.

When one user edits a record, others immediately see who owns the lock, get blocked from accidental overwrite, and can request handoff. The package supports both classic polling and Laravel Echo push updates.

Preview

Filament Resource Lock preview

Lock state, collaboration actions, and audit history in one flow.


Contents


Why this package

Main goals

Key behavior


Install

filament-resource-lock:install does the following:

Publish only specific resources


Quick start (3 steps)

1) Add lock relation to model

2) Add lock behavior to EditRecord page

3) Show lock indicator in list table

ResourceAuditCreatorColumn reads the created audit entry and shows the creator’s display name (— when missing).


Configuration

All options live in config/filament-resource-lock.php.

Most important keys

Permissions

By default, actions use auth()->user()?->can(...):

Set permission to null to skip policy check for that action.

Example config skeleton


Broadcast mode (Laravel Echo)

heartbeat checks state on interval (for example, every 10 seconds).
broadcast pushes updates through private channels, so lock changes and notifications arrive almost instantly.

Setup checklist

  1. Configure Laravel broadcasting (Reverb/Pusher/Ably/etc.) per official docs.
  2. Make sure frontend exposes window.Echo with private().
  3. Keep published resources/js/filament-resource-lock/echo.js aligned with your broker/env setup.
  4. Set:

  5. Optionally tune:
    • transports.broadcast.channel_prefix
    • transports.broadcast.event
    • transports.broadcast.renew_interval_seconds

Official guide: Laravel Broadcasting


Audit history (snapshots + rollback)

The package can store versioned snapshots of form state and render visual per-field diffs.

What happens on save

  1. Snapshot of previous state is captured.
  2. New snapshot is captured after save.
  3. Changed fields are computed (old vs new).
  4. A new audit version is stored in resource_lock_audits.
  5. If limit is exceeded, oldest rows are pruned (audit.max_entries_per_resource).

Add audit to EditRecord

HasResourceAudit works standalone, but together with lock trait it groups entries by lock_cycle_id.

Add audit to CreateRecord

To capture the initial creation of a record (with a distinct “Created” badge in history), add the same trait to the create page:

The trait hooks afterCreate() and stores version v1 with event = created. Later edits are stored as saved / “Updated”.

If you override afterCreate(), call syncResourceAuditAfterCreate() after the record is persisted.

Overriding save()

The trait defines save() that calls syncResourceAuditBeforeSave(), then parent::save(), then syncResourceAuditAfterSave(). In PHP, a save() method on your page class replaces the trait’s method entirely, so that wrapper is skipped unless you repeat it.

If you override save(), keep audit working by invoking the same two bridges around your persistence (typically parent::save()):

If your implementation does not call parent::save(), call syncResourceAuditBeforeSave() before the record is written and syncResourceAuditAfterSave() after it is successfully persisted (and only then).

There is no Filament or PHP mechanism in this package that can inject “always run before/after save” when the page replaces save() with a completely custom flow: alternatives such as beforeSave() / afterSave() suffer from the same issue if those methods are overridden on the page. Until a better integration exists, the explicit calls above are the supported approach.

Rollback selected fields

From the audit history slide-over:

The service restores selected field values and creates a new audit version representing rollback changes.

Supported diff renderers


Custom fields in audit diff

For custom Filament fields, add HasAuditDiffPreview to provide custom HTML previews in history modal.

Security note: callback output is rendered as trusted HTML. Always escape user-controlled fragments.


Soft release route

The package registers signed route filament-resource-lock.release (web, signed middleware).

In broadcast flow it is used on tab close / SPA leave:

Make sure APP_URL is correct, otherwise signed URL validation may fail.


Localization

Translations are loaded from:

Included locales:


Development notes

If package is connected via local path repository in monorepo, after code changes it is usually enough to run:


License

MIT.


All versions of filament-resource-lock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
filament/filament Version ^5.0
laravel/framework 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 androsamp/filament-resource-lock contains the following files

Loading the files please wait ...