定制 niladam/filament-auto-logout 二次开发

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

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

niladam/filament-auto-logout

Composer 安装命令:

composer require niladam/filament-auto-logout

包简介

A filament plugin that auto logs out your users if they are idle.

README 文档

README


Latest Version on Packagist Total Downloads

Compatibility

Package Version Filament Version
v1 v3
v2 v4
v3 v5

Installation

You can install the package via composer:

composer require niladam/filament-auto-logout

Install the package

php artisan filament-auto-logout:install

You can publish the config file with:

php artisan vendor:publish --tag="filament-auto-logout-config"

This is the contents of the published config file:

use Carbon\Carbon;
use Filament\View\PanelsRenderHook;

return [
    /**
     * Disable or enable the plugin
     */
    'enabled' => env('FILAMENT_AUTO_LOGOUT_ENABLED', true),

    /**
     * The duration in seconds your users can be idle before being logged out.
     *
     * The duration needs to be specified in seconds.
     *
     * A sensible default has been set to 15 minutes
     */
    'duration_in_seconds' => env('FILAMENT_AUTO_LOGOUT_DURATION_IN_SECONDS', Carbon::SECONDS_PER_MINUTE * 15),

    /**
     * A notification will be sent to the user before logging out.
     *
     * This sets the seconds BEFORE sending out the notification.
     */
    'warn_before_in_seconds' => env('FILAMENT_AUTO_LOGOUT_WARN_BEFORE_IN_SECONDS', 30),

    /**
     * The plugin comes with a small time left box which will display the time left
     * before the user will be logged out.
     */
    'show_time_left' => env('FILAMENT_AUTO_LOGOUT_SHOW_TIME_LEFT', true),

    /**
     * What should the time left box display before the timer?
     *
     * A default has been set to 'Time left:'
     */
    'time_left_text' => env('FILAMENT_AUTO_LOGOUT_TIME_LEFT_TEXT', 'Time left:'),

    /**
     * Where should the badge be rendered?
     *
     * @see https://filamentphp.com/docs/3.x/support/render-hooks#available-render-hooks for a list of supported hooks.
     */
    'location' => env('FILAMENT_AUTO_LOGOUT_LOCATION', PanelsRenderHook::GLOBAL_SEARCH_BEFORE),
];

Usage

Quick Usage:

$panel
    ->plugins([
        AutoLogoutPlugin::make(),
    ]);

Customised Usage

use Carbon\Carbon;
use Filament\Support\Colors\Color;
use Niladam\FilamentAutoLogout\AutoLogoutPlugin;

$panel
    ->plugins([
        AutoLogoutPlugin::make()
            ->color(Color::Emerald)                             // Set the color. Defaults to Color::Stone
            ->icon('heroicon-o-arrow-right-start-on-rectangle') // Change the icon. Defaults to 'heroicon-o-clock' 
            ->disableIf(fn () => auth()->id() === 1)            // Disable the user with ID 1
            ->logoutAfter(Carbon::SECONDS_PER_MINUTE * 5)       // Logout the user after 5 minutes
            ->withoutWarning()                                  // Disable the warning before logging out
            ->withoutTimeLeft()                                 // Disable the time left
            ->timeLeftText('Oh no. Kicking you in...')          // Change the time left text
            ->timeLeftText('')                                  // Remove the time left text (displays only countdown)
    ]);

Translations

This package has multi-language support. So you will have to first publish the translations using:

php artisan vendor:publish --tag="filament-auto-logout-translations"

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.

niladam/filament-auto-logout 适用场景与选型建议

niladam/filament-auto-logout 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26.84k 次下载、GitHub Stars 达 22, 最近一次更新时间为 2024 年 11 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 niladam/filament-auto-logout 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 26.84k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-26