承接 dennis-kashirin/yii2-session-timeout-warning 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dennis-kashirin/yii2-session-timeout-warning

最新稳定版本:1.1.0

Composer 安装命令:

composer require dennis-kashirin/yii2-session-timeout-warning

包简介

Users are warned about expiring session.

README 文档

README

Users are warned about expiring session.

Differences with original code

  1. Added support of Russian and Ukrainian languages

This is simple implementation of session timeout warning. Plugin does not make any ajax calls, otherwise it would not work with many projects. Components like RBAC are using user identity all time and auth session is renewed every request.

This plugin writes and reads cookies.

It supports multiple tabs. Plugin will not work if user is logged out from server side, or sessions are cleared from database.

If user session is expired, page will be reloaded.

Install

Either run

$ php composer.phar require dennis-kashirin/yii2-session-timeout-warning "@dev"

or add

"dennis-kashirin/yii2-session-timeout-warning": "@dev"

to the require section of your composer.json file.

Usage

  1. Register bootstrap class in application config.
[
  'bootstrap' => [
      [
          'class' => \mgcode\sessionWarning\components\SessionWarningBootstrap::className(),
          'initMessages' => true,
      ]
  ],
];

initMesscompoages property initializes translations. Currently only English, Latvian, Russian and Ukrainian languages are supported. Please contribute and add your language.

  1. Add controller to controllerMap in application config.
[
  'controllerMap' => [
    'session-warning' => [
      'class' => 'mgcode\sessionWarning\controllers\SessionWarningController',
    ],
  ],
];

Note: If you are using RBAC, you should allow all visitors to access this controller.

  1. Insert widget in layout view.
<?= \mgcode\sessionWarning\widgets\SessionWarningWidget::widget([
  //... Properties  ...
]); ?>

Properties:

  • logoutUrl - if is set, logout button will be shown before Continue button. Default: null
  • extendUrl - url where ajax request is sent, when continue button is clicked. Default: ['/session-warning/extend']
  • warnBefore - time in seconds before user is warned about expiring session. Default: 300 (5min)

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2021-09-30