matteomascellani/filament-preview-files
Composer 安装命令:
composer require matteomascellani/filament-preview-files
包简介
Reusable Filament actions and views for file and ticket previews
README 文档
README
Reusable Filament v4 actions and Blade views for:
- media zoom preview (images and PDF)
- media open in new tab
- graceful fallback when URL is missing (red unavailable icon)
Requirements
- Filament
^4.0 - Spatie Media Library
^11.0 - Laravel
^11.28|^12.0 - PHP
^8.2
Install
From Packagist (recommended)
composer require matteomascellani/filament-preview-files
From local path (development)
Add to root composer.json:
{
"repositories": [
{
"type": "path",
"url": "packages/matteomascellani/filament-preview-files"
}
]
}
Then require the package:
composer require matteomascellani/filament-preview-files:*
Service Provider
The package uses Laravel auto-discovery via extra.laravel.providers, so in normal setups you do not need to register the provider manually.
If your project disables package discovery, register manually:
Matteomascellani\FilamentPreviewFiles\FilamentPreviewFilesServiceProvider::class,
Optional: publish config.
php artisan vendor:publish --tag=filament-preview-files-config
Usage
1) Use in a Filament table (Actions)
use Matteomascellani\FilamentPreviewFiles\Actions\MediaPreviewAction; use Matteomascellani\FilamentPreviewFiles\Actions\MediaOpenAction; use Matteomascellani\FilamentPreviewFiles\Actions\MediaZoomAction; use Matteomascellani\FilamentPreviewFiles\Actions\MediaUnavailableAction;
->recordActions([ // Wrapper that injects all table actions: // - zoom (only for image/pdf with valid URL) // - open in new tab (only with valid URL) // - unavailable fallback (red no-symbol when URL is missing) ...MediaPreviewAction::make( urlResolver: fn ($record) => $record->getUrl(), mimeResolver: fn ($record) => (string) $record->mime_type, ), ])
If you prefer separate actions, all single actions are still available:
->recordActions([ MediaZoomAction::make( urlResolver: fn ($record) => $record->getUrl(), mimeResolver: fn ($record) => (string) $record->mime_type, ), MediaOpenAction::make( urlResolver: fn ($record) => $record->getUrl(), ), MediaUnavailableAction::make( urlResolver: fn ($record) => $record->getUrl(), ), ])
2) Use in a normal Blade view
You can include the package views directly, even outside Filament table actions.
Media zoom modal content:
@include('filament-preview-files::modals.media-zoom-content', [ 'url' => $url, 'mimeType' => $mimeType, 'label' => $label, ])
Helper component-like partial for link + zoom trigger:
@include('filament-preview-files::components.media-zoom-link', [ 'url' => $url, 'mimeType' => $mimeType, 'label' => $label, ])
Current Usage In This Project
app/Filament/Resources/System/MediaResource.php...MediaPreviewAction::make(...)in table actions
Branching And Versioning
1.x: Filament 3 compatible line (Laravel 11)2.x: Filament 4 compatible line
Suggested release policy:
- publish
v1.*tags from1.x - publish
v2.*tags from2.x
matteomascellani/filament-preview-files 适用场景与选型建议
matteomascellani/filament-preview-files 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 13 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matteomascellani/filament-preview-files 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matteomascellani/filament-preview-files 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-15