定制 devtical/laravel-drunk-on-419 二次开发

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

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

devtical/laravel-drunk-on-419

最新稳定版本:v1.0.1

Composer 安装命令:

composer require devtical/laravel-drunk-on-419

包简介

Handles 419 errors gracefully by redirecting users when CSRF tokens expire.

README 文档

README

Latest Version on Packagist Tests Total Downloads

Cover

Handles 419 errors gracefully by redirecting users when CSRF tokens expire.

Installation

You can install the package via composer:

composer require devtical/laravel-drunk-on-419

Usage

Automatic Middleware Registration

Once installed, the package automatically registers the middleware in the web group to handle CSRF token expiry errors. This means it will handle all requests in the web middleware group without requiring manual registration.

Flashing Session Data

When a CSRF token expires and a 419 error occurs, the middleware redirects the user to the previous page (if available) or a fallback URL, with an error message flashed to the session. You can display the error message in your views using the following:

@session('expired')
    {{ $value }}
@endsession

Publishing Language Files

You can publish the language files to customize the error message:

php artisan vendor:publish --tag=drunkon419-translations

This will create a language file in your application at lang/vendor/drunkon419/session.php. You can modify the expired key to suit your needs:

return [
    'expired' => 'Your session has expired. Please try again.',
];

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固