Skip to content

sirmerdas/ip-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sirmerdas/ip-helper

Just a real simple package which helps you to work with different versions of ips.

Requirements:

  • php ^ 8.0
  • phpunit/phpunit": ">=11.1"

Installation

Run this composer code $ composer require sirmerdas/ip-helper

Basic Usage

use Sirmerdas\IpHelper\IpTools;

include "vendor/autoload.php";


print_r(IpTools::getClientIpInfo()); // [[address] => ::1,[version] => 6]

Get given ip address version
echo IpTools::getIpVersion("::1"); // 6
Check if given ip is version 4
var_dump(IpTools::verifyIpV4("::1")); // false
Check if given ip is version 6
var_dump(IpTools::verifyIpV6("::1")); // true
Generate a random ip version 4
echo IpTools::fakeIpV4(); // 127.0.0.1
Generate a random ip version 6
echo IpTools::fakeIpV6(); // ::1

License

  • This package is This package is created and modified under the MIT License.

About

Package that helps you to work with ips.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages