panchodp/laravel-fingerprint 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

panchodp/laravel-fingerprint

最新稳定版本:0.1.4

Composer 安装命令:

composer require panchodp/laravel-fingerprint

包简介

Laravel Session theft protection via client fingerprinting — auto-invalidates sessions used from unrecognized devices.

README 文档

README

Logo for Laravel Fingerprint Package

Laravel Fingerprint

PHP Total Downloads Latest Stable Version License Tests

Protects against session hijacking by generating a fingerprint from the client's request headers. If the fingerprint changes mid-session, the session is invalidated and the user is redirected.

Requirements

  • PHP ^8.4
  • Laravel 12 or 13

Installation

composer require panchodp/laravel-fingerprint

Usage

Add the fingerprint middleware to the routes you want to protect:

Route::middleware(['auth', 'fingerprint'])->group(function () {
    // protected routes
});

Or enable it globally for all web routes via the LARAVEL_FINGERPRINT_GLOBAL=true environment variable (see Configuration).

On the first request, the fingerprint is stored in the session. On subsequent requests, it is compared — if it doesn't match, the session is invalidated and the user is redirected.

Configuration

Publish the config file:

php artisan vendor:publish --tag=laravel-fingerprint-config

Available options in config/laravel_fingerprint.php:

Key Env variable Default Description
enabled LARAVEL_FINGERPRINT_ENABLED true Enable or disable the package
include_ip LARAVEL_FINGERPRINT_INCLUDE_IP false Include the client IP in the fingerprint (not recommended for mobile/dynamic IPs)
redirect_route LARAVEL_FINGERPRINT_REDIRECT_ROUTE login Named route to redirect to when the fingerprint doesn't match
global LARAVEL_FINGERPRINT_GLOBAL false Apply the middleware automatically to all routes in the web middleware group

How it works

The fingerprint is a SHA-256 hash of:

UserAgent | Accept-Language | Accept-Encoding [ | IP ]

If a session cookie is stolen and used from a different device or browser, the fingerprint won't match and the session will be invalidated.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固