PHPackages                             rogervila/current-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. rogervila/current-ip

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

rogervila/current-ip
====================

PHP Current IP

1.0.0(7mo ago)01.2k↓26.8%MITPHPPHP ^7.3 || ^8.0CI passing

Since Nov 18Pushed 7mo agoCompare

[ Source](https://github.com/rogervila/current-ip)[ Packagist](https://packagist.org/packages/rogervila/current-ip)[ RSS](/packages/rogervila-current-ip/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Status](https://github.com/rogervila/current-ip/workflows/test/badge.svg)](https://github.com/rogervila/current-ip/actions)[![StyleCI](https://camo.githubusercontent.com/dfc738ca9311e674ba3df904cc7abda1694768828c41a4a78608e2ac75428a62/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3231313635373132312f736869656c643f6272616e63683d6d61696e)](https://github.styleci.io/repos/211657121)

[![Latest Stable Version](https://camo.githubusercontent.com/2613c73327a1bd052e79db9cdc87e61f8218e01624f0f6a6e1b35a698c0ff436/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f63757272656e742d69702f762f737461626c65)](https://packagist.org/packages/rogervila/current-ip)[![Total Downloads](https://camo.githubusercontent.com/ff7f01f5248163bca69b2cea518a719c310a4f79d4f294a7d05139f45f543279/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f63757272656e742d69702f646f776e6c6f616473)](https://packagist.org/packages/rogervila/current-ip)[![License](https://camo.githubusercontent.com/4dd2f67a24b4743ee039580be05d0e2bb917860c3bae4e1eb0ae54cfc9a293dc/68747470733a2f2f706f7365722e707567782e6f72672f726f67657276696c612f63757272656e742d69702f6c6963656e7365)](https://packagist.org/packages/rogervila/current-ip)

Current IP
==========

[](#current-ip)

A lightweight, framework-agnostic PHP library for detecting the client's IP address from HTTP requests. No dependencies, no framework requirements—just pure PHP.

Features
--------

[](#features)

- 🚀 **Zero dependencies** - Pure PHP implementation
- 🔍 **Proxy-aware** - Handles X-Forwarded-For and other proxy headers
- ✅ **IP validation** - Built-in validation using PHP's filter functions
- 🔒 **Security-conscious** - Validates IP format and handles spoofing scenarios
- 📦 **Lightweight** - Single function, minimal footprint
- 🌐 **Framework-agnostic** - Works with any PHP application

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

[](#installation)

Install via Composer:

```
composer require rogervila/current-ip
```

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

[](#requirements)

- PHP 7.3 or higher

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
