Versions
CommunityAdds WordPress-style version history to any Filament resource, with a field-level diff viewer and one-click restore of past versions.
Author:
Elvin Qulizada
Package health
BetaAutomated checks of this plugin's Composer package
15 checks
- Passed: GitHub Actions pinned to SHA
- Skipped: GitLab CI includes pinned to SHA
- Skipped: Open security advisories
- Passed: Dependabot PR responsiveness — No open Dependabot PRs.
- Skipped: Renovate MR responsiveness
- Passed: Dependabot or Renovate configured
- Passed: Dependency update cooldown configured
- Passed: Provides a security policy
- Passed: Abandoned or archived — No consulted source marks the package abandoned (packagist, github).
- Passed: Commit and release recency — Active: last commit 0 days ago; no release date available.
- Skipped: composer.lock not committed by library
- Skipped: Dist archive is lean
- Skipped: Current Laravel version supported
- Skipped: Current PHP version supported
- Skipped: Current Symfony version supported
filament/
namespace. Review the source and install at your own risk. Found
malware or an unresolved security issue the author won't
address?
Report it
.
Documentation
Adds WordPress-style version history to any Eloquent model used in a Filament v5 resource: every save is snapshotted, a "History" tab shows the timeline with a field-level diff, and any past version can be restored with one click.
#Installation
You can install the package via composer:
composer require elvin-qulizade/filament-versions
[!IMPORTANT] If you have not set up a custom theme and are using Filament Panels follow the instructions in the Filament Docs first.
After setting up a custom theme add the plugin's views to your theme css file or your app's css file if using the standalone packages.
@source '../../../../vendor/elvin-qulizade/filament-versions/resources/**/*.blade.php';
You can publish and run the migrations with:
php artisan vendor:publish --tag="filament-versions-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="filament-versions-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-versions-views"
This is the contents of the published config file:
return [
// Attributes never stored in a version snapshot, on top of any
// model-level $versionExcept property.
'excluded_attributes' => [
'password',
'remember_token',
'created_at',
'updated_at',
],
// Maximum number of versions kept per model instance. Older versions
// are pruned automatically after each save, and via `versions:prune`.
'max_versions_per_model' => 50,
// Optional callable(Version $version): bool to gate the "Restore" action.
// Left null, restoring is allowed for anyone who can see the History tab.
'authorize_restore' => null,
// Global retroactive cleanup, on top of the automatic per-save pruning
// above. Off by default since per-save pruning already keeps storage
// bounded for new versions.
'schedule' => [
'enabled' => false,
'cron' => '0 3 * * *',
],
];
#Usage
- Add the trait and contract to any Eloquent model you want version history for:
use ElvinQulizade\Versions\Concerns\HasVersions;
use ElvinQulizade\Versions\Contracts\Versionable;
class Post extends Model implements Versionable
{
use HasVersions;
}
- Register the History tab on the model's Filament resource:
use ElvinQulizade\Versions\Filament\RelationManagers\VersionsRelationManager;
public static function getRelations(): array
{
return [
VersionsRelationManager::class,
];
}
That's it — every create/update is snapshotted automatically, the Edit page gets a "History" tab with a timeline, a field-level diff per version, and a one-click "Restore" action. To exclude fields from just one model in code, define protected array $versionExcept = [...] on it — or use the "Excluded fields" button on the History tab to manage it from the panel instead, per model class.
Select any two rows in the History table and use the "Compare" bulk action to diff them directly against each other, instead of only against the previous version.
Soft-deleted owner records keep working: their history and restore action remain reachable even while trashed.
Old versions beyond max_versions_per_model are pruned automatically after each save. To prune retroactively (e.g. after lowering the limit), run:
php artisan versions:prune
php artisan versions:prune --model="App\Models\Post" --keep=20
To run that automatically instead, set schedule.enabled to true in the config file (and schedule.cron if you want something other than daily at 3am).
#Testing
composer test
#Changelog
Please see CHANGELOG for more information on what has changed recently.
#Contributing
Please see CONTRIBUTING for details.
#Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
#Credits
#License
The MIT License (MIT). Please see License File for more information.
The author
Full-stack developer specializing in Laravel, Filament. I build modern web applications, SaaS platforms, and developer tools, with a strong focus on clean architecture, reusable components, and great developer experience. I enjoy contributing to the Filament ecosystem by creating plugins and tools that solve real-world development needs.
From the same author
Featured Plugins
A selection of plugins curated by the Filament team
Noir Theme
A theme that gives panels a focused, refined look with near-black surfaces, crisp actions, and restrained color.
Filament
Compact Theme
A theme that makes data-heavy panels easier to scan by fitting more useful information on each screen.
Filament
Spotlight Pro
Browse your Filament Panel with ease. Filament Spotlight Pro adds a Spotlight like Command Palette to your Filament Panel.
Dennis Koch