Ssdp
, (*1)
Simple Service Discovery Protocol (SSDP) library for PHP., (*2)
Requirements
This library has the following requirements:, (*3)
Installation
Install Composer in your project:, (*4)
$ curl -s https://getcomposer.org/installer | php
Add the package to your composer.json
and install it via Composer:, (*5)
$ php composer.phar require gravitymedia/ssdp
Usage
// 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);
Testing
Clone this repository, install Composer and all dependencies:, (*6)
``` bash
$ php composer.phar install, (*7)
Run the test suite:
``` bash
$ php composer.phar test
Generating documentation
Clone this repository, install Composer and all dependencies:, (*8)
``` bash
$ php composer.phar install, (*9)
Generate the documentation to the `build/docs` directory:
``` bash
$ php composer.phar doc
Contributing
Please see CONTRIBUTING for details., (*10)
Credits
License
The MIT License (MIT). Please see License File for more information., (*11)