PHP code example of buibr / multicast-ip

1. Go to this page and download the library: Download buibr/multicast-ip library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

buibr / multicast-ip example snippets


use Buibr\Multicast\Multicast;

$ipAddress = '239.255.0.1';

if (Multicast::isValidMulticastIP($ipAddress)) {
    echo "Valid Multicast IP";
}

use Buibr\Multicast\Multicast;

$ip = Multicast::create('udp://239.0.0.10:12345');

$ip->add(); 
//or
$ip->getIp()->increment();
print (string)$mc // 'udp://239.0.0.11:12345', 

$ip->sub();
or
$ip->getIp()->decrement();
print (string)$mc // 'udp://239.0.0.9:12345',


use Buibr\Multicast\Multicast;

$url = Multicast::create('udp://239.0.0.1:12345');
$url->getIp()->isLocal(); // true 

$url = Multicast::create('udp://224.0.1.1:12345');
$url->getIp()->isGlobal(); // true