PHPackages                             jeremykenedy/laravel-ip-capture - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. jeremykenedy/laravel-ip-capture

ActiveLibrary[Security](/categories/security)

jeremykenedy/laravel-ip-capture
===============================

A Laravel package to automatically capture and track IP addresses on Eloquent model actions such as signup, login, update, and deletion.

v1.1.0(2mo ago)11↓90.9%MITPHPPHP ^8.2|^8.3CI passing

Since Mar 28Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/jeremykenedy/laravel-ip-capture)[ Packagist](https://packagist.org/packages/jeremykenedy/laravel-ip-capture)[ RSS](/packages/jeremykenedy-laravel-ip-capture/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (13)Versions (7)Used By (0)

    ![Laravel IP Capture](art/banner-light.svg)

A Laravel package to automatically capture and track IP addresses on Eloquent model actions such as signup, login, update, and deletion.

[![Total Downloads](https://camo.githubusercontent.com/da14ae8aee39138e4297ad80ad94449560d810a2a2735f9ef8c7a820fdb7546e/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d796b656e6564792f6c61726176656c2d69702d636170747572652f642f746f74616c2e737667)](https://packagist.org/packages/jeremykenedy/laravel-ip-capture)[![Latest Stable Version](https://camo.githubusercontent.com/6e815e56ca2350030f7b7830c6cbb357fd5495f152fef2a1e445cf80743441b4/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d796b656e6564792f6c61726176656c2d69702d636170747572652f762f737461626c652e737667)](https://packagist.org/packages/jeremykenedy/laravel-ip-capture)[![Tests](https://github.com/jeremykenedy/laravel-ip-capture/actions/workflows/tests.yml/badge.svg)](https://github.com/jeremykenedy/laravel-ip-capture/actions/workflows/tests.yml)[![StyleCI](https://camo.githubusercontent.com/7a00e72e61ea7bc993d97448fcef0ff5f2c655298d7097c5272783a6632d47e7/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f313139343830373538382f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/1194807588?branch=main)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

#### Table of Contents

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Add the Trait](#add-the-trait)
    - [Available Methods](#available-methods)
    - [Custom Columns](#custom-columns)
    - [IP Hashing](#ip-hashing)
- [Testing](#testing)
- [License](#license)

Features
--------

[](#features)

- Automatic IP capture on model events (signup, login, update, delete)
- Tracks 6 configurable IP columns per model
- Simple trait-based integration with any Eloquent model
- Proxy and load balancer aware (Cloudflare, X-Forwarded-For, etc.)
- Optional IP hashing for privacy compliance (SHA-256 or custom algorithm)
- Fluent interface for chaining multiple IP captures
- Configurable column names and enable/disable per column
- Publishable config, migrations, and translations

Requirements
------------

[](#requirements)

DependencyVersionPHP^8.2 | ^8.3Laravel^10.0 | ^11.0 | ^12.0 | ^13.0Installation
------------

[](#installation)

```
composer require jeremykenedy/laravel-ip-capture
```

Publish the config file:

```
php artisan vendor:publish --tag=ip-capture-config
```

Publish and run the migration:

```
php artisan vendor:publish --tag=ip-capture-migrations
php artisan migrate
```

Configuration
-------------

[](#configuration)

The config file is published to `config/ip-capture.php`.

OptionTypeDefaultDescription`enabled`bool`true`Enable or disable IP capture globally`null_ip`string`'0.0.0.0'`Fallback value when IP cannot be determined`trust_proxies`bool`true`Use Laravel trusted proxy headers first`hash`bool`false`Hash IP addresses before storage`hash_algo`string`'sha256'`Hashing algorithm (any algo supported by `hash()`)`columns`arraysee belowEnable/disable individual IP columns### Default Columns

[](#default-columns)

ColumnDefault`signup_ip_address``true``signup_confirmation_ip_address``true``signup_sm_ip_address``true``admin_ip_address``true``updated_ip_address``true``deleted_ip_address``true`Environment variables:

```
IP_CAPTURE_ENABLED=true
IP_CAPTURE_NULL_IP=0.0.0.0
IP_CAPTURE_TRUST_PROXIES=true
IP_CAPTURE_HASH=false
IP_CAPTURE_HASH_ALGO=sha256
```

Usage
-----

[](#usage)

### Add the Trait

[](#add-the-trait)

Add the `CapturesIp` trait to your User model (or any Eloquent model):

```
use Jeremykenedy\LaravelIpCapture\Traits\CapturesIp;

class User extends Authenticatable
{
    use CapturesIp;
}
```

### Available Methods

[](#available-methods)

MethodDescription`captureIp()`Returns the current client IP as a string`setSignupIp()`Sets the signup IP address column`setSignupConfirmationIp()`Sets the signup confirmation IP column`setSocialSignupIp()`Sets the social media signup IP column`setAdminIp()`Sets the admin action IP column`setUpdatedIp()`Sets the updated IP column`setDeletedIp()`Sets the deleted IP column`setIpColumn(string $column)`Sets a specific IP column by name`getIpColumns()`Returns all populated IP columns as an arrayAll setter methods return `static` for fluent chaining:

```
$user->setSignupIp()->setAdminIp()->save();
```

### Custom Columns

[](#custom-columns)

Add a custom column to the config:

```
'columns' => [
    'signup_ip_address'  => true,
    'custom_ip_address'  => true,  // your custom column
],
```

Then use `setIpColumn()` to capture:

```
$user->setIpColumn('custom_ip_address');
```

### IP Hashing

[](#ip-hashing)

Enable hashing for privacy compliance:

```
IP_CAPTURE_HASH=true
IP_CAPTURE_HASH_ALGO=sha256
```

When enabled, all captured IPs are hashed before storage. This is a one-way operation.

Testing
-------

[](#testing)

```
composer test
```

Or run Pest directly:

```
./vendor/bin/pest --ci
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance83

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

4

Last Release

86d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/05cef7d9ee65723b129042943511207fb34db74a56afbf67b5900987f758c161?d=identicon)[jeremykenedy](/maintainers/jeremykenedy)

---

Top Contributors

[![jeremykenedy](https://avatars.githubusercontent.com/u/6244570?v=4)](https://github.com/jeremykenedy "jeremykenedy (7 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")

---

Tags

laravelsecuritytrackingIPAuditcapture

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/jeremykenedy-laravel-ip-capture/health.svg)

```
[![Health](https://phpackages.com/badges/jeremykenedy-laravel-ip-capture/health.svg)](https://phpackages.com/packages/jeremykenedy-laravel-ip-capture)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.6k](/packages/larastan-larastan)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[alajusticia/laravel-logins

Session management in Laravel apps, user notifications on new access, support for multiple separate remember tokens, IP geolocation, User-Agent parser

2013.2k](/packages/alajusticia-laravel-logins)[calebdw/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

15104.9k4](/packages/calebdw-larastan)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
