PHP code example of tomaj / php-evostream

1. Go to this page and download the library: Download tomaj/php-evostream 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/ */

    

tomaj / php-evostream example snippets


$ composer 

$command = new \Tomaj\Evostream\Command\Version();
$evostream = new \Tomaj\Evostream\Evostream(new \Tomaj\Evostream\Protocol\HttpProtocol());
$result = $evostream->addServer('127.0.0.1:7777')
	->runCommand($command);

if ($result->allOk()) {
	print_r($result->getResponses());
}

$command = new \Tomaj\Evostream\Command\PullStream();
$command->setUri('some stream url')
	->setKeepAlive(true)
	->setLocalStreamName('some local stream url')
	->setTtl(10); // more sets available - check evostream api
$evostream = new \Tomaj\Evostream\Evostream(new \Tomaj\Evostream\Protocol\HttpProtocol());
$result = $evostream->addServers(array('192.168.1.101:7777', '192.168.1.102:7777'))
	->runCommand($command);

if ($result->allOk()) {
	print_r($result->getResponses());
}

php cli/run.php 129.168.1.101 pullStream uri=rtmp://... localStreamName=teststream