承接 xetaio/xetaravel-iptraceable 相关项目开发

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

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

xetaio/xetaravel-iptraceable

最新稳定版本:13.0.0

Composer 安装命令:

composer require xetaio/xetaravel-iptraceable

包简介

A simple package that update an IP field when the user login into the application.

README 文档

README

Latest Stable Version Total Downloads Tests Laravel 13+ License

A simple Laravel package that tracks the IP address of a user on login. Also handles the remember_me token via middleware.

Requirements

  • PHP >= 8.3
  • Laravel >= 13.0

Installation

composer require xetaio/xetaravel-iptraceable

Service Provider

Laravel auto-discovers the service provider. If you have disabled auto-discovery, register it manually in bootstrap/providers.php:

return [
    // ...
    Xetaio\IpTraceable\Providers\IpTraceableServiceProvider::class,
];

Middleware (remember me support)

The package ships with an optional middleware that updates the IP on requests authenticated via a remember me token. Register it in bootstrap/app.php after StartSession:

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Xetaio\IpTraceable\Http\Middleware\IpTraceable::class,
    ]);
})

Note: The middleware must be registered after Illuminate\Session\Middleware\StartSession.

Configuration

Publish the config file:

php artisan vendor:publish --provider="Xetaio\IpTraceable\Providers\IpTraceableServiceProvider" --tag=config

Available options in config/iptraceable.php:

return [
    'fields' => [
        'last_login_ip' => 'last_login_ip',   // Column name for the IP address
        'last_login_date' => null,               // Set a column name to enable, or null to disable
    ],
];

Database

Add the required columns to your users table:

$table->ipAddress('last_login_ip')->nullable();
$table->dateTime('last_login_date')->nullable(); // Optional — enable in config

How it works

Trigger Mechanism
Standard login IpTraceableSubscriber listens to Illuminate\Auth\Events\Login and updates the IP automatically
Remember me token IpTraceable middleware checks viaRemember() on each request and updates the IP if needed

Testing

composer test

Contributing

Pull requests are welcome.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固