PHP User IP Address Class Library is used to get current User IP Address and validate given IP address.
The preferred way to install this extension is through composer.
To install PHP UserIP library Use following command:
$ composer require yogeshkoli/user-ip
Or you can also clone the complete repository with Git Use following command:
$ https://github.com/yogeshkoli/user-ip.git
This library is supported by PHP versions 5.6
Available methods in this library:
UserIP::get();
UserIP::validate($ip);
Here is sample examples of using this package:
<?php
require __DIR__ . '/../vendor/autoload.php';
use YogeshKoli\UserIP\UserIP;
var_dump(UserIP::get());
Output:
/example/UserIPTest.php:7:string '192.168.10.1' (length=12)
<?php
require __DIR__ . '/../vendor/autoload.php';
use YogeshKoli\UserIP\UserIP;
$ip = '192.168.10.1';
var_dump(UserIP::validate($ip));
Output:
/example/ValidateIPTest.php:9:boolean true
- Check for open issues or open a new issue to start a discussion around a bug or feature.
- Fork the repository on GitHub to start making your changes.
- Write one or more tests for the new feature or that expose the bug.
- Make code changes to implement the feature or fix the bug.
- Send a pull request to get your changes merged and published.
This is intended for large and long-lived objects.
This project is licensed under MIT license. See the LICENSE file for more info.
2017 Yogesh Koli, yogeshkoli.com
If you find it useful, let me know 😉