定制 relisiuol/filament-relative-time 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

relisiuol/filament-relative-time

Composer 安装命令:

composer require relisiuol/filament-relative-time

包简介

Filament 4 column powered by @github/relative-time-element.

README 文档

README

A Filament v4 table column powered by @github/relative-time-element, bundled locally with esbuild. It renders relative, absolute (Intl) or duration values in the user's time zone (or a forced IANA time zone), with a SSR fallback.

Documentation

Since v1.1 the column reuses the native TextColumn view, so helpers like alignment(), wrap(), copyable state, descriptions, etc. keep working while the formatted value is swapped with <relative-time>.

Quick install

composer require relisiuol/filament-relative-time
php artisan vendor:publish --tag=filament-relative-time

Enable the plugin on your panel:

use Relisiuol\FilamentRelativeTime\RelativeTimePlugin;

public function panel(\Filament\Panel $panel): Panel
{
    return $panel->plugins([
        RelativeTimePlugin::make(),
    ]);
}

Column usage

use Relisiuol\FilamentRelativeTime\Columns\RelativeTimeColumn as RT;

RT::make('created_at')
  ->label('Created')
  ->format('relative')          // relative | datetime | duration
  ->precision('minute')         // for relative/duration
  ->threshold('P30D')           // ISO8601 – switch to absolute after 30 days
  ->timeZone('auto')            // 'auto' (browser) or 'Europe/Paris'
  ->locale('en-GB')             // otherwise <html lang> / browser
  ->datetimeIntl([              // only when format='datetime'
    'year'           => 'numeric',
    'month'          => 'short',
    'day'            => '2-digit',
    'hour'           => '2-digit',
    'minute'         => '2-digit',
    'time-zone-name' => 'short',
  ])
  ->formatStyle('short')        // 'long' | 'short' | 'narrow'
  ->tense('auto')               // 'auto' | 'past' | 'future'
  ->absolutePrefix('on')        // override default absolute prefix
  ->noTitle()                   // drop <relative-time> title attribute
  ->elementAttributes(['aria-label'=>'Creation date']);

Need 12-hour output or no timezone suffix? Tweak datetimeIntl(), e.g. swap 'hour' => '2-digit' for 'hour' => 'numeric', add 'second' => '2-digit', drop 'time-zone-name', or opt-in to 'date-style' / 'time-style' presets if your target browsers support them.

Global defaults come from config/filament-relative-time.php. Publish the config and set keys like 'format-style' => 'short' or 'prefix' => '' to apply them across every column, including the default time-zone attribute. All options are defined as null, to use default options from @github/relative-time-element.

Other attributes from the Web Component (e.g. prefix, format-style, tense, no-title) are mapped with dedicated helpers or fall back to elementAttributes([...]) for any edge-case attribute.

Quality & submission

  • Hosted on GitHub, distributed via Packagist.
  • Public documentation in docs/.
  • No CDN; CSP-friendly (serve the local bundle from your domain).

License

MIT. Dependency: @github/relative-time-element (MIT).

relisiuol/filament-relative-time 适用场景与选型建议

relisiuol/filament-relative-time 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 889 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「timezone」 「datetime」 「tables」 「column」 「filament」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 relisiuol/filament-relative-time 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 relisiuol/filament-relative-time 我们能提供哪些服务?
定制开发 / 二次开发

基于 relisiuol/filament-relative-time 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 889
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-27