atldays/laravel-visitor
Composer 安装命令:
composer require atldays/laravel-visitor
包简介
Laravel package for resolving typed visitor information from the current request, including IP address, user agent, geo data, and configurable fingerprints.
README 文档
README
Resolve a full visitor profile from the current Laravel request.
atldays/laravel-visitor gives you a clean, typed abstraction over the most important visitor signals:
- IP address
- User-Agent
- preferred language and accepted languages
- parsed agent metadata through
atldays/laravel-agent - geo metadata through
atldays/laravel-geo - configurable fingerprint generation
It is designed to be the thin orchestration layer that connects those concerns into one consistent visitor object.
Why This Package
When you need to understand who is visiting your application, you usually end up stitching together several low-level request details by hand.
This package gives you one place to resolve:
- the raw visitor identity signals
- the parsed device and browser information
- the geo lookup result
- the language context
- a stable fingerprint strategy that you can customize
Installation
composer require atldays/laravel-visitor
Quick Start
Resolve the current visitor through the manager:
use Atldays\Visitor\Facades\VisitorManager; $visitor = VisitorManager::request(); $visitor->ip(); $visitor->userAgent(); $visitor->language()->language(); $visitor->language()->languages(); $visitor->fingerprint(); $visitor->agent(); $visitor->geo();
Resolve the current visitor directly from the request:
$visitor = request()->visitor();
Resolve the current visitor through the Visitor facade:
use Atldays\Visitor\Facades\Visitor; Visitor::ip(); Visitor::userAgent(); Visitor::language(); Visitor::fingerprint(); Visitor::agent(); Visitor::geo();
Create a visitor manually:
use Atldays\Visitor\Facades\VisitorManager; $visitor = VisitorManager::from( '8.8.8.8', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36', [ 'language' => 'en-US', 'languages' => ['en-US', 'en'], ], );
API Overview
VisitorManager
Use VisitorManager when you want to resolve a full visitor object:
VisitorManager::request()VisitorManager::from($ip, $userAgent, $language = [])
Visitor
Use Visitor when you want quick access to the current resolved visitor:
Visitor::ip()Visitor::userAgent()Visitor::language()Visitor::fingerprint()Visitor::agent()Visitor::geo()
Language Object
Language data is exposed as a dedicated DTO instead of plain strings scattered across the visitor object.
$language = $visitor->language(); $language->language(); // Most preferred language $language->languages(); // All accepted languages in priority order
Fingerprint Driver
By default, the package builds a fingerprint from the visitor IP address and User-Agent.
Use Atldays\Visitor\Fingerprints\IpUserAgentGeo when you want to include the geo provider, continent, country, and city in the fingerprint.
Publish the config file if you want to replace the default fingerprint driver:
php artisan vendor:publish --tag=visitor-config
You can replace the implementation in the config:
return [ 'fingerprint' => [ 'driver' => App\Support\Visitors\CustomFingerprint::class, ], ];
Your custom driver must implement Atldays\Visitor\Contracts\FingerprintContract.
Built On
This package works as an orchestration layer on top of:
License
The MIT License (MIT). Please see LICENSE.md for more information.
atldays/laravel-visitor 适用场景与选型建议
atldays/laravel-visitor 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 96 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「geo」 「user-agent」 「laravel」 「visitor」 「IP」 「Fingerprint」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 atldays/laravel-visitor 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 atldays/laravel-visitor 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 atldays/laravel-visitor 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Detect user Browser, OS and Device through Browser USER AGENT
Show geo marker on a mapbox map
Show geo shape on a mapbox map with drawing capabilities
Platine User Agent is a lightweight library for detecting user browser, device, OS, CPU
Official PHP SDK for the IPGeolocation.io IP Location API with single and bulk lookup support.
Parses a user agent string to detect Internet Explorer
统计信息
- 总下载量: 96
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 47
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-20