Simple Service Discovery Protocol (SSDP) library for PHP.
This library has the following requirements:
- PHP 5.6+
Install Composer in your project:
$ curl -s https://getcomposer.org/installer | php
Add the package to your composer.json
and install it via Composer:
$ php composer.phar require gravitymedia/ssdp
// Initialize autoloader
require 'vendor/autoload.php';
// Import classes
use GravityMedia\Ssdp\Client;
use GravityMedia\Ssdp\Event\DiscoverEvent;
use GravityMedia\Ssdp\Options\AliveOptions;
use GravityMedia\Ssdp\Options\DiscoverOptions;
use GravityMedia\Ssdp\UniqueServiceName;
// Create client
$client = new Client();
// Add listeners
$client->getEventDispatcher()
->addListener(DiscoverEvent::EVENT_DISCOVER, function (DiscoverEvent $event) {
var_dump($event);
});
$client->getEventDispatcher()
->addListener(DiscoverEvent::EVENT_DISCOVER_ERROR, function (DiscoverEvent $event) {
var_dump($event->getException());
});
// Create options
$options = new DiscoverOptions();
// Discover devices and services
$client->discover($options);
Clone this repository, install Composer and all dependencies:
$ php composer.phar install
Run the test suite:
$ php composer.phar test
Clone this repository, install Composer and all dependencies:
$ php composer.phar install
Generate the documentation to the build/docs
directory:
$ php composer.phar doc
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.