Skip to content

Async Simple Service Discovery Protocol (SSDP), built on top of ReactPHP.

License

Notifications You must be signed in to change notification settings

clue/reactphp-ssdp

Repository files navigation

clue/reactphp-ssdp

CI status installs on Packagist

Async Simple Service Discovery Protocol (SSDP), built on top of ReactPHP.

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.

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.

Table of Contents

Note: This project is in early alpha stage! Feel free to report any issues you encounter.

Quickstart example

Once installed, you can use the following code to search all available UPnP devices in your network:

<?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.

Install

The recommended way to install this library is through composer. New to composer?

{
    "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.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

composer install

To run the test suite, go to the project root and run:

vendor/bin/phpunit

License

MIT

About

Async Simple Service Discovery Protocol (SSDP), built on top of ReactPHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Languages