Tamper-evident seals for Eloquent models (keyed MACs and signatures, key rotation, an append-only ledger with external anchors), idempotency keys, single-use nonces and URLs, and RFC 9421 HTTP message signatures.
roundly-consulting/sentinel-for-laravel is a Laravel package for tamper-evident seals for eloquent models (keyed macs and signatures, key rotation, an append-only ledger with external anchors), idempotency keys, single-use nonces and urls, and rfc 9421 http message signatures..
It currently has 5 GitHub stars and 125 downloads on Packagist (latest version 1.2.2).
Install it with composer require roundly-consulting/sentinel-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
Know when your data was changed behind your application's back, and make every request count
once. Sentinel seals Eloquent models with keyed MACs or signatures, detects any change made
outside the application (a SQL console, a mass update(), a restored backup), and adds
idempotency keys, single-use nonces and URLs, and RFC 9421 HTTP message signatures.
Requires PHP 8.4+ (ext-hash, ext-mbstring; ext-sodium for Ed25519 keys), Laravel 12 or 13,
and SQLite, PostgreSQL or MySQL.
composer require roundly-consulting/sentinel-for-laravel
php artisan sentinel:install # publishes config + migrations, prints the key lines for .env
php artisan migrate
If your sealed models or users have UUID/ULID keys, set sentinel.key_type /
sentinel.actor_key_type before migrating. php artisan sentinel:check confirms the setup.
Declare a seal on the model — every Eloquent write now seals the row:
use Illuminate\Database\Eloquent\Model;
use RoundlyConsulting\Sentinel\Concerns\HasSeals;
use RoundlyConsulting\Sentinel\Contracts\Sealable;
use RoundlyConsulting\Sentinel\Definition\SealBuilder;
final class Invoice extends Model implements Sealable
{
use HasSeals;
public static function defineSeals(SealBuilder $seals): void
{
$seals->seal('financial')->attributes('customer_id', 'currency', 'amount', 'status');
}
}
Verify wherever it matters:
use RoundlyConsulting\Sentinel\Facades\Sentinel;
$invoice->isIntact(); // true when every seal verifies
Sentinel::for($invoice)->verifyOrFail(); // throws TamperedModelException otherwise
Route::get('/invoices/{invoice}', ShowInvoice::class)->middleware('sentinel.verified');
Someone runs UPDATE invoices SET amount = 0 WHERE id = 42 in a SQL console:
Sentinel::for($invoice)->verify();
// VerificationResult { status: Tampered, reason: 'mac', changedAttributes: ['a:amount'], … }
$invoice->update(['note' => 'x']); // TamperedModelException: refused until acknowledged
Sentinel::for($invoice)->by($admin)->because('INC-88: refund fixed by the DBA')->acknowledge();
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/sentinel-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
The MIT License (MIT). See LICENSE.md.