clue/reactphp-ssdp
, (*1)
Async Simple Service Discovery Protocol (SSDP), built on top of ReactPHP., (*2)
SSDP is part of Universal Plug and Play (UPnP)
and is commonly used to discover network services on home networks without
requiring any manual configuration, such as automatically discovering printers,
multimedia devices and network routers., (*3)
This library implements SSDP as defined in the
UPnP device architecture definition (PDF)
and uses HTTP over Multicast UDP (HTTPMU) as defined in the
IETF draft.
As an alternative, some devices use DNS-Based Service Discovery (DNS-SD) instead
as defined in RFC 6763., (*4)
Table of Contents, (*5)
Note: This project is in early alpha stage! Feel free to report any issues you encounter., (*6)
Quickstart example
Once installed, you can use the following code to search all available UPnP devices in your network:, (*7)
<?php
require __DIR__ . '/vendor/autoload.php';
$client = new Clue\React\Ssdp\Client();
$client->search()->then(
function () {
echo 'Search completed' . PHP_EOL;
},
function(Exception $e) {
echo 'There was an error searching for devices: ' . $e . PHP_EOL;
},
function ($progress) {
echo 'Found a device: ' . PHP_EOL;
var_dump($progress);
echo PHP_EOL;
}
);
See also the examples., (*8)
Install
The recommended way to install this library is through composer. New to composer?, (*9)
{
"require": {
"clue/ssdp-react": "dev-master"
}
}
This project aims to run on any platform and thus does not require any PHP
extensions and supports running on legacy PHP 5.3 through current PHP 8+ and
HHVM.
It's highly recommended to use the latest supported PHP version for this project., (*10)
Tests
To run the test suite, you first need to clone this repo and then install all
dependencies through Composer:, (*11)
composer install
To run the test suite, go to the project root and run:, (*12)
vendor/bin/phpunit
License
MIT, (*13)