wrossmann/sixtofour

There is no license information available for the latest version (1.0.0) of this package.

Library for conversion of IPv4 addresses to 6to4-encapsulated IPv6.

1.0.0 2016-05-20 19:32 UTC

This package is auto-updated.

Last update: 2024-04-09 10:59:55 UTC


README

Library for conversion of IPv4 addresses to 6to4-encapsulated IPv6.

Example Usage

<?php 
require('vendor/autoload.php');
use \wrossmann\sixtofour\SixToFour;

$v4 = '222.173.190.239';
$v6 = SixToFour::convFourToSix($v4);
$bin = SixToFour::str2bin($v4);
var_dump(
	bin2hex($bin),
	SixToFour::bin2str($bin),
	SixToFour::bin2str($bin, true),
	SixToFour::convSixToFour($v6)
);

Output:

string(32) "200200de00ad00be00ef000000000000"
string(15) "222.173.190.239"
string(18) "2002:de:ad:be:ef::"
string(15) "222.173.190.239"