PHPackages                             ruskid/yii2-ip-behavior - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ruskid/yii2-ip-behavior

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ruskid/yii2-ip-behavior
=======================

Yii2 Behavior that records User IP address on Updates/Inserts

109.9k↓50%3[2 issues](https://github.com/ruskid/yii2-ip-behavior/issues)PHP

Since Nov 7Pushed 6y ago2 watchersCompare

[ Source](https://github.com/ruskid/yii2-ip-behavior)[ Packagist](https://packagist.org/packages/ruskid/yii2-ip-behavior)[ RSS](/packages/ruskid-yii2-ip-behavior/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Yii2 Ip Behavior
================

[](#yii2-ip-behavior)

Yii2 Behavior that records User IP address on Updates/Inserts

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require ruskid/yii2-ip-behavior "dev-master"
```

or add

```
"ruskid/yii2-ip-behavior": "dev-master"
```

to the require section of your `composer.json` file.

Or
--

[](#or)

I wanted to test the composer xd. You can just copy paste IpBehavior.php to behaviors folder or any folder you like. (just don't forget to change the namespace).

Usage
-----

[](#usage)

You can call it like this.

```
public function behaviors() {
        return [
            ...
            'ip' => [
                'class' => IpBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['created_ip', 'updated_ip'],
                    ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_ip',
                ],
            ]
            ...
        ];
    }
```

Or like this. where value can be a string or an anonymous function that will return a string.

```
public function behaviors() {
        return [
            ...
            'ip' => [
                'class' => IpBehavior::className(),
                'createdIpAttribute' => 'created_ip',
                'updatedIpAttribute' => 'updated_ip',
                'value' => '127.0.0.1',
            ]
            ...
        ];
    }
```

Extras
------

[](#extras)

this will set user's IP address to the attribute of the model.

```
$user->setIp('updated_ip');
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/12093591a2c01098c8613b3d765dd14f64e952691b0048cd0f5ee65438a77244?d=identicon)[ruskid](/maintainers/ruskid)

---

Top Contributors

[![ruskid](https://avatars.githubusercontent.com/u/8279841?v=4)](https://github.com/ruskid "ruskid (22 commits)")

### Embed Badge

![Health badge](/badges/ruskid-yii2-ip-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/ruskid-yii2-ip-behavior/health.svg)](https://phpackages.com/packages/ruskid-yii2-ip-behavior)
```

###  Alternatives

[codebyray/laravel-review-rateable

Review &amp; Rating system for Laravel 10, 11 &amp; 12

310351.9k](/packages/codebyray-laravel-review-rateable)[egeloen/google-map-bundle

Provides a google map integration for your Symfony2 Project.

216716.3k3](/packages/egeloen-google-map-bundle)[torann/laravel-meta-tags

A package to manage Header Meta Tags

65273.3k4](/packages/torann-laravel-meta-tags)[aura/html

Provides HTML escapers and helpers, including form input helpers.

52270.5k21](/packages/aura-html)[leric/php-thrift

Thrift client api for PHP(version sync with thrift)

38320.6k3](/packages/leric-php-thrift)[presseddigital/linkit

One link field to rule them all.

28160.7k](/packages/presseddigital-linkit)

PHPackages © 2026

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