visualbuilder/filament-versionable
Composer 安装命令:
composer require visualbuilder/filament-versionable
包简介
Effortlessly manage revisions of your Eloquent models in Filament with polymorphic user support (Fork of mansoor/filament-versionable).
README 文档
README
Filament Versionable (Polymorphic User Fork)
Fork of mansoor/filament-versionable with polymorphic user support
This fork uses visualbuilder/versionable which supports polymorphic user relationships, enabling version tracking across multiple user model types (User, Admin, Associate, EndUser, OrganisationUser, etc.).
Version Compatibility
| Package Version | Filament | Laravel | PHP |
|---|---|---|---|
| 5.x | 5.x | 11.x, 12.x | 8.2+ |
| 4.x | 4.x | 10.x, 11.x | 8.2+ |
Effortlessly manage your Eloquent model revisions in Filament. It includes:
- A Filament page to show the Diff of what has changed and who changed it
- A list of Revisions by different users
- A Restore action to restore the model to any state
Installation
You can install the package via composer:
composer require visualbuilder/filament-versionable
Then, publish the config file and migrations:
php artisan vendor:publish --provider="Visualbuilder\Versionable\ServiceProvider"
Run the migration command:
php artisan migrate
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 and css to your theme css file.
@import '../../../../vendor/visualbuilder/filament-versionable/resources/css/plugin.css'; @source '../../../../vendor/visualbuilder/filament-versionable/resources/**/*.blade.php';
Usage
Add Visualbuilder\Versionable\Versionable trait to your model and set $versionable attributes.
NOTE: Make sure to add protected $versionStrategy = VersionStrategy::SNAPSHOT; This would save all the $versionable attributes when any of them changed. There are different bug reports on using VersionStrategy::DIFF
use Visualbuilder\Versionable\VersionStrategy; class Post extends Model { use Visualbuilder\Versionable\Versionable; protected $versionable = ['title', 'content']; protected $versionStrategy = VersionStrategy::SNAPSHOT; }
Create a Revisons Resource page to show Revisions, it should extend the Visualbuilder\FilamentVersionable\RevisionsPage. If you were to create a Revisions page for ArticleResource, it would look like:
namespace App\Filament\Resources\ArticleResource\Pages; use App\Filament\Resources\ArticleResource; use Visualbuilder\FilamentVersionable\RevisionsPage; class ArticleRevisions extends RevisionsPage { protected static string $resource = ArticleResource::class; }
Next, Add the ArticleRevisions page (that you just created) to your Resource
use App\Filament\Resources\ArticleResource\Pages; public static function getPages(): array { return [ ... 'revisions' => Pages\ArticleRevisions::route('/{record}/revisions'), ]; }
Add RevisionsAction to your edit/view pages, this action would only appear when there are any versions for the model you are viewing/editing.
use Visualbuilder\FilamentVersionable\Page\RevisionsAction; protected function getHeaderActions(): array { return [ RevisionsAction::make(), ]; }
You can also add the RevisionsAction to your table.
use Visualbuilder\FilamentVersionable\Table\RevisionsAction; $table->actions([ RevisionsAction::make(), ]);
You are all set! Your app should store the model states and you can manage them in Filament.
Customisation
If you want to change the UI for Revisions page, you may publish the publish the views to do so.
php artisan vendor:publish --tag="filament-versionable-views"
If you want more control over how the versions are stored, you may read the Visualbuilder Versionable Docs (based on overtrue/laravel-versionable).
Strip Tags from Diff
You can easily remove/strip HTML tags from the diff by just overriding shouldStripTags method inside your revisions page.
class ArticleRevisions extends RevisionsPage { protected static string $resource = ArticleResource::class; public function shouldStripTags(): bool { return true; } }
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.
visualbuilder/filament-versionable 适用场景与选型建议
visualbuilder/filament-versionable 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.64k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「polymorphic」 「Revisions」 「filament」 「visualbuilder」 「filament-versionable」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 visualbuilder/filament-versionable 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 visualbuilder/filament-versionable 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 visualbuilder/filament-versionable 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Ownership simplify management of Eloquent model's owner.
Implement a polymorphic morphMany relationship for managing attachments within Filament
A Laravel package providing a full-featured, framework-agnostic commenting system for any Eloquent model.
Metamel Addresses is a polymorphic Laravel package, for address book management. You can add addresses to any eloquent model with ease.
Neos CMS plugin for managing content revisions
An update for from neurony. Create multiple revisions of any Eloquent model record along with its underlying relationships
统计信息
- 总下载量: 2.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-23
