PHPackages                             dimchtz/clientip - 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. dimchtz/clientip

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

dimchtz/clientip
================

Client IP detector and various IP validators

0.1.0(5y ago)27MITPHP

Since Oct 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/DimChtz/ClientIP)[ Packagist](https://packagist.org/packages/dimchtz/clientip)[ RSS](/packages/dimchtz-clientip/feed)WikiDiscussions main Synced 6d ago

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

PHP ClientIP - v0.1.0
=====================

[](#php-clientip---v010)

Client IP detector and various IP validators

[![Total Downloads](https://camo.githubusercontent.com/4de47dcce696650f0dd4fd7c63277edc503a987d2e9b4941f47ccf323e9e9b61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696d6368747a2f636c69656e7469702e737667)](https://packagist.org/packages/dimchtz/clientip)[![Latest Stable Version](https://camo.githubusercontent.com/ee216ba84ed27e6373ca52152830de6a1b0ad39d211f031a53626bc59e5add82/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696d6368747a2f636c69656e7469702e737667)](https://packagist.org/packages/dimchtz/clientip)[![Software License](https://camo.githubusercontent.com/676b1bce8bdcad2236d65f2a85edb064ff2e10bcc9f0fee72f69a26bb551820a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696d6368747a2f636c69656e7469702e7376673f7374796c653d666c61742d737175617265)](https://github.com/DimChtz/ClientIP/blob/main/LICENSE)

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

[](#installation)

```
composer require dimchtz/clientip
```

Initialization
--------------

[](#initialization)

```
$client = new DimChtz\ClientIP\ClientIP();
```

You can also add additional IP services (for the external IP detection functionality):

```
$client = new DimChtz\ClientIP\ClientIP(array(
	'http://v4.ident.me/',
	'http://checkip.amazonaws.com/',
	'http://ipecho.net/plain',
));
```

Usage &amp; Examples
--------------------

[](#usage--examples)

#### Getting client's IP (without localhost check)

[](#getting-clients-ip-without-localhost-check)

```
$client = new DimChtz\ClientIP\ClientIP();

echo 'Visitor\'s IP: ' . $client->get_ip(false);
```

#### Getting client's IP (with localhost check)

[](#getting-clients-ip-with-localhost-check)

By default `get_ip()` will return the external IP if the user is on localhost.

```
$client = new DimChtz\ClientIP\ClientIP();

echo 'Visitor\'s IP: ' . $client->get_ip();
```

#### Getting client's external IP

[](#getting-clients-external-ip)

```
$client = new DimChtz\ClientIP\ClientIP();

echo 'Visitor\'s external IP: ' . $client->get_external_ip();
```

#### Check if the visitor's IP is localhost

[](#check-if-the-visitors-ip-is-localhost)

```
$client = new DimChtz\ClientIP\ClientIP();

echo $client->is_localhost() ? 'It is localhost' : 'It is not localhost';
```

#### Check if an IP is valid (both IPv4 &amp; IPv6)

[](#check-if-an-ip-is-valid-both-ipv4--ipv6)

```
echo DimChtz\ClientIP\ClientIP::is_valid_ip('192.168.56.23') ? 'It is valid IP' : 'It is not valid IP';
```

#### Check if an IP is valid IPv4

[](#check-if-an-ip-is-valid-ipv4)

```
echo DimChtz\ClientIP\ClientIP::is_valid_ipv4('192.168.56.23') ? 'It is valid IPv4' : 'It is not valid IPv4';
```

#### Check if an IP is valid IPv6

[](#check-if-an-ip-is-valid-ipv6)

```
echo DimChtz\ClientIP\ClientIP::is_valid_ipv6('::1') ? 'It is valid IPv6' : 'It is not valid IPv6';
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2051d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33261325?v=4)[Dimitris Chatzis](/maintainers/dimchtz)[@DimChtz](https://github.com/DimChtz)

---

Top Contributors

[![DimChtz](https://avatars.githubusercontent.com/u/33261325?v=4)](https://github.com/DimChtz "DimChtz (21 commits)")

---

Tags

clientdetectiplocalhostvisitor

### Embed Badge

![Health badge](/badges/dimchtz-clientip/health.svg)

```
[![Health](https://phpackages.com/badges/dimchtz-clientip/health.svg)](https://phpackages.com/packages/dimchtz-clientip)
```

###  Alternatives

[muqsit/simple-packet-handler

Handle specific data packets (virion for PMMP API 4.0.0)

426.1k3](/packages/muqsit-simple-packet-handler)[webdevstudios/taxonomy_core

A tool to make custom taxonomy registration just a bit simpler. Automatically registers taxonomy labels, and provides helpful methods.

394.0k1](/packages/webdevstudios-taxonomy-core)[metabolism/wp-steroids

Supercharge Wordpress with YML configuration, increase performance and security

237.1k1](/packages/metabolism-wp-steroids)[zman/zman

A Jewish date converter and helper.

186.4k](/packages/zman-zman)[pudongping/hyperf-wise-locksmith

A mutex library provider for the Hyperf framework, designed to enable serialized execution of PHP code in high-concurrency scenarios.

106.3k2](/packages/pudongping-hyperf-wise-locksmith)

PHPackages © 2026

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