All Projects → akalongman → Php Ip Tools

akalongman / Php Ip Tools

Licence: other
Useful tools for IP manipulations

Projects that are alternatives of or similar to Php Ip Tools

Ship
A simple, handy network addressing multitool with plenty of features
Stars: ✭ 81 (-46.71%)
Mutual labels:  ipv6, ip, ipv4
private-ip
Check if IP address is private.
Stars: ✭ 26 (-82.89%)
Mutual labels:  ipv6, ipv4, ip
Iptools
PHP Library for manipulating network addresses (IPv4 and IPv6)
Stars: ✭ 163 (+7.24%)
Mutual labels:  ipv6, ip, ipv4
go-external-ip
a Golang library to get your external ip from multiple services
Stars: ✭ 55 (-63.82%)
Mutual labels:  ipv6, ipv4, ip
Geolocate-IP-Browser-Extension
A browser extension, which shows you the origin of your IP address.
Stars: ✭ 21 (-86.18%)
Mutual labels:  ipv6, ipv4, ip
Aggregator
A stand-alone class implementation of the IPv4+IPv6 IP+CIDR aggregator from CIDRAM.
Stars: ✭ 19 (-87.5%)
Mutual labels:  ipv6, ipv4, ip
IPpy
🚀 Ping IP addresses and domains in parallel to find the accessible and inaccessible ones.
Stars: ✭ 54 (-64.47%)
Mutual labels:  ipv6, ipv4, ip
captcp
A open source program for TCP analysis of PCAP files
Stars: ✭ 110 (-27.63%)
Mutual labels:  ipv6, ipv4, ip
bacnet-stack
BACnet Protocol Stack library provides a BACnet application layer, network layer and media access (MAC) layer communications services.
Stars: ✭ 199 (+30.92%)
Mutual labels:  ipv6, ipv4, ip
ip
Immutable value object for IPv4 and IPv6 addresses, including helper methods and Doctrine support.
Stars: ✭ 212 (+39.47%)
Mutual labels:  ipv6, ipv4, ip
Ip
🌏根据IpV4、IpV6地址获取定位信息的PHP🐘组件 PHP components that obtain location information based on IpV4, IpV6 addresses
Stars: ✭ 23 (-84.87%)
Mutual labels:  ipv6, ipv4, ip
Icmplib
Easily forge ICMP packets and make your own ping and traceroute.
Stars: ✭ 58 (-61.84%)
Mutual labels:  ipv6, ipv4
Ipnetwork
A library to work with CIDRs in rust
Stars: ✭ 64 (-57.89%)
Mutual labels:  ipv6, ipv4
Internet.nl
Internet standards compliance test suite
Stars: ✭ 56 (-63.16%)
Mutual labels:  ipv6, ipv4
China Operator Ip
中国运营商IPv4/IPv6地址库-每日更新
Stars: ✭ 1,255 (+725.66%)
Mutual labels:  ipv6, ip
Ansible Role Firewall
A role to manage iptables rules which doesn't suck.
Stars: ✭ 81 (-46.71%)
Mutual labels:  ipv6, ipv4
Weihanli.common
common tools,methods,extension methods etc... .net 常用工具类,公共方法,常用扩展方法等,基础类库
Stars: ✭ 152 (+0%)
Mutual labels:  utility, library
The Bits And Bytes Of Computer Networking
Networking , N/W layer, Transport and Application Layer, Networking Service, Internet, Troubleshooting , N/W future
Stars: ✭ 87 (-42.76%)
Mutual labels:  ipv6, ipv4
Packetsender
Network utility for sending / receiving TCP, UDP, SSL
Stars: ✭ 1,349 (+787.5%)
Mutual labels:  ipv6, ipv4
Commons Ip Math
Stars: ✭ 54 (-64.47%)
Mutual labels:  ipv6, ipv4

PHP IP Tools

Build Status Latest Stable Version Total Downloads Downloads Month License

Universal IP Tools for manipulation on IPv4 and IPv6.

Require this package with Composer

Install this package through Composer. Edit your project's composer.json file to require longman/ip-tools.

Create composer.json file:

{
    "name": "yourproject/yourproject",
    "type": "project",
    "require": {
        "longman/ip-tools": "~1.1.0"
    }
}

And run composer update

Or run a command in your command line:

composer require longman/ip-tools

Usage

<?php
$loader = require __DIR__.'/vendor/autoload.php';

use Longman\IPTools\Ip;

// Validating
$status = Ip::isValid('192.168.1.1'); // true

$status = Ip::isValid('192.168.1.256'); // false


// ip2long, long2ip

/// IPv4
$long = Ip::ip2long('192.168.1.1'); // 3232235777

$dec = Ip::long2ip('3232235777'); // 192.168.1.1

/// IPv6
$long = Ip::ip2long('fe80:0:0:0:202:b3ff:fe1e:8329'); // 338288524927261089654163772891438416681

$dec = Ip::long2ip('338288524927261089654163772891438416681', true); // fe80::202:b3ff:fe1e:8329


// Matching

/// IPv4
$status = Ip::match('192.168.1.1', '192.168.1.*'); // true

$status = Ip::match('192.168.1.1', '192.168.*.*'); // true

$status = Ip::match('192.168.1.1', '192.168.*.*'); // true

$status = Ip::match('192.168.1.1', '192.168.0.*'); // false


$status = Ip::match('192.168.1.1', '192.168.1/24'); // true

$status = Ip::match('192.168.1.1', '192.168.1.1/255.255.255.0'); // true

$status = Ip::match('192.168.1.1', '192.168.0/24'); // false

$status = Ip::match('192.168.1.1', '192.168.0.0/255.255.255.0'); // false


$status = Ip::match('192.168.1.5', '192.168.1.1-192.168.1.10'); // true

$status = Ip::match('192.168.5.5', '192.168.1.1-192.168.10.10'); // true

$status = Ip::match('192.168.5.5', '192.168.6.1-192.168.6.10');


$status = Ip::match('192.168.1.1', array('122.128.123.123', '192.168.1.*', '192.168.123.124')); // true

$status = Ip::match('192.168.1.1', array('192.168.123.*', '192.168.123.124'));

/// IPv6

$status = Ip::match('2001:cdba:0000:0000:0000:0000:3257:9652', '2001:cdba:0000:0000:0000:0000:3257:*'); // true

$status = Ip::match('2001:cdba:0000:0000:0000:0000:3257:9652', '2001:cdba:0000:0000:0000:0000:*:*'); // true

$status = Ip::match('2001:cdba:0000:0000:0000:0000:3257:9652',
                    '2001:cdba:0000:0000:0000:0000:3257:1234-2001:cdba:0000:0000:0000:0000:3257:9999'); // true


$status = Ip::match('2001:cdba:0000:0000:0000:0000:3258:9652', '2001:cdba:0000:0000:0000:0000:3257:*'); // false

$status = Ip::match('2001:cdba:0000:0000:0000🔢3258:9652', '2001:cdba:0000:0000:0000:0000:*:*'); // false

$status = Ip::match('2001:cdba:0000:0000:0000:0000:3257:7778',
                    '2001:cdba:0000:0000:0000:0000:3257:1234-2001:cdba:0000:0000:0000:0000:3257:7777'); // false


This code is available on Github. Pull requests are welcome.

Troubleshooting

If you like living on the edge, please report any bugs you find on the PHP IP Tools issues page.

Contributing

See CONTRIBUTING.md for information.

License

Please see the LICENSE included in this repository for a full copy of the MIT license, which this project is licensed under.

Credits

Full credit list in CREDITS

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].