This package is abandoned and no longer maintained. No replacement package was suggested.

Simple Service Discovery Protocol (SSDP) library for PHP

v0.1.0 2015-02-20 22:26 UTC

This package is auto-updated.

Last update: 2023-02-27 01:05:35 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads Dependency Status

Simple Service Discovery Protocol (SSDP) library for PHP.

Requirements

This library has the following requirements:

  • PHP 5.6+

Installation

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

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:

$ php composer.phar install

Run the test suite:

$ php composer.phar test

Generating documentation

Clone this repository, install Composer and all dependencies:

$ php composer.phar install

Generate the documentation to the build/docs directory:

$ php composer.phar doc

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.