PHPackages                             tixastronauta/acc-ip - 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. tixastronauta/acc-ip

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

tixastronauta/acc-ip
====================

Retrieve the most accurate client's IP Address

1.3.0(1y ago)212.5k↓50%21MITPHPPHP &gt;=5.4.0CI passing

Since Dec 14Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (1)Versions (5)Used By (1)

tixastronauta/acc-ip
====================

[](#tixastronautaacc-ip)

[![Latest Stable Version](https://camo.githubusercontent.com/5022f696374e868f490ea4657bb9ff81d156fc15a0454c8e7943e9d30c02db28/68747470733a2f2f706f7365722e707567782e6f72672f746978617374726f6e617574612f6163632d69702f76)](//packagist.org/packages/tixastronauta/acc-ip)[![Total Downloads](https://camo.githubusercontent.com/8c6c9a9e3fb88d2efef5a0c3de492ea577a88864765ba00b7d3be1e07bc61ab9/68747470733a2f2f706f7365722e707567782e6f72672f746978617374726f6e617574612f6163632d69702f646f776e6c6f616473)](//packagist.org/packages/tixastronauta/acc-ip)[![Latest Unstable Version](https://camo.githubusercontent.com/a5070bcaf250e7b4ef862d6736bad4c435a4d1a720057230b9f8abae7cfe33f6/68747470733a2f2f706f7365722e707567782e6f72672f746978617374726f6e617574612f6163632d69702f762f756e737461626c65)](//packagist.org/packages/tixastronauta/acc-ip)[![License](https://camo.githubusercontent.com/5797d344b3a043d199c561c42c6dcc49d940d4a715a06fafe883edb930b99952/68747470733a2f2f706f7365722e707567782e6f72672f746978617374726f6e617574612f6163632d69702f6c6963656e7365)](//packagist.org/packages/tixastronauta/acc-ip)[![CodeFactor](https://camo.githubusercontent.com/a7b450120fe3c1c9553d26ec3dc6b779c2f9af0f838fe32dc8870ed46a9ff663/68747470733a2f2f7777772e636f6465666163746f722e696f2f7265706f7369746f72792f6769746875622f746978617374726f6e617574612f6163632d69702f6261646765)](https://www.codefactor.io/repository/github/tixastronauta/acc-ip)[![Build Status](https://github.com/tixastronauta/acc-ip/actions/workflows/php.yml/badge.svg)](https://github.com/tixastronauta/acc-ip/actions/workflows/php.yml)

Accurate IP Address
===================

[](#accurate-ip-address)

PHP library to retrieve the most accurate client's accurate IP Address.

Instead of simply checking the `$_SERVER['REMOTE_ADDR']` variable, this library checks for the most common headers that contain the client's IP Address:

HeaderDescription**HTTP\_CF\_CONNECTING\_IP**Cloudflare-provided real IP of the client. Best when using Cloudflare as a proxy.**HTTP\_X\_FORWARDED\_FOR**Standard header used by proxies and load balancers. Can contain multiple IPs. The first valid non-private IP is usually the client.**HTTP\_X\_REAL\_IP**Used by Nginx and some proxies to pass the real IP.**HTTP\_X\_CLUSTER\_CLIENT\_IP**Commonly set by AWS Elastic Load Balancer and other cloud providers.**HTTP\_FORWARDED\_FOR**RFC-compliant alternative to `X-Forwarded-For`. Similar functionality.**HTTP\_FORWARDED**RFC-compliant `Forwarded` header (e.g., `for=192.168.1.1;proto=http`).**HTTP\_X\_FORWARDED**Similar to `X-Forwarded-For`, but used in some legacy systems.**HTTP\_CLIENT\_IP**Sometimes set by proxies but is easily spoofed, so it should not be fully trusted.**REMOTE\_ADDR**IP address of the direct connection. Often the load balancer or proxy IP rather than the real client. Used as a last resort.Installing
==========

[](#installing)

Add this library as a composer dependency:

```
composer require tixastronauta/acc-ip
```

Using
=====

[](#using)

```
require 'vendor/autoload.php'

use TixAstronauta\AccIp\AccIp as AccIp;

$accIp = new AccIp();
$ipAddress = $accIp->getIpAddress(); // this is the client's accurate IP Address. false on failure
```

License
=======

[](#license)

```
The MIT License (MIT)

Copyright (c) 2015 Tiago 'Tix' Carvalho

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance43

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~1116 days

Total

4

Last Release

453d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47f0cd7b6d6def2ff52c6192902ccf53293af3ad9ec92048c435aff56dae6f05?d=identicon)[tixastronauta](/maintainers/tixastronauta)

---

Top Contributors

[![tixastronauta](https://avatars.githubusercontent.com/u/402726?v=4)](https://github.com/tixastronauta "tixastronauta (12 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")

---

Tags

client ipreal ip addressclient ip addressvisitor ipvisitor ip addressaccurate ip address

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tixastronauta-acc-ip/health.svg)

```
[![Health](https://phpackages.com/badges/tixastronauta-acc-ip/health.svg)](https://phpackages.com/packages/tixastronauta-acc-ip)
```

###  Alternatives

[yidas/client-ip

Get client IP with safe and coincident way from server even behind Proxy or Load-Balancer

2386.1k](/packages/yidas-client-ip)[molayli/laravel-cloudflare-real-ip

Get the real ip for laravel applications behind cloudflare's reverse proxy

1221.0k](/packages/molayli-laravel-cloudflare-real-ip)

PHPackages © 2026

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