PHP Library for communication with Roku External Control Protocol
Install composer in a common location or in your project:
curl -s http://getcomposer.org/installer | php
Create the composer.json file as follows:
{
"require": {
"svilborg/php-roku": "dev-master"
}
}
Run the composer installer:
php composer.phar install
- PHP Version >=5.3.2.
- PHP Httpful Library
Execute commands :
$roku = new \Roku\Roku("192.168.72.10", 8060, 0.2);
$roku->up();
$roku->select();
$roku->literals("[email protected]");
$roku->down();
$roku->down();
$roku->select();
List the applicatioin installed on the device :
$roku = new \Roku\Roku("192.168.72.10", 8060, 0.2);
$applications = $roku->apps();
foreach ($applications as $application) {
echo $application->getId();
echo $application->getVersion();
echo $application->getName();
echo "\n";
}
Get device information :
$roku = new \Roku\Roku("192.168.72.10", 8060, 0.2);
$device = $roku->device();
echo $device->getSerialNumber();
echo $device->getModelName();
echo $device->getModelDescription();
// etc..
For the list of commands execute :
$ vendor/bin/roku --help
It displays :
PHP Roku Console
Usage: roku [OPTION] ..
-h <host> Host
-p <port> Port
-d <delay> Delay between each command
-i Interactive mode (Listens for keyboard keystrokes)
-c <commands> Command mode (Specify commands to be executed, Example -c "up down [email protected] down select home")
-t Test Mode (Does not send commands.Just simulates them.)
--help Shows this help
Example usage of command and interactive modes :
$ vendor/bin/roku -h 192.168.72.10 -p 8060 -d 1 -c "up [email protected] down down select home"
$ vendor/bin/roku -h 192.168.72.10 -d 1 -i
First, install PHPUnit with composer.phar install --dev
, then run
./vendor/bin/phpunit
.