Skip to content

CyberLine/phUPnP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phUPnP

PHP based UPnP device discovery

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License

Example

Install using composer

composer require cyberline/phupnp

Discover all devices with timeout of 1 second

namespace CyberLine\phUPnP
{
    require 'src/Scanner.php';

    try {
        $scanner = new Scanner;
        $scanner
            ->setTimeout(1);

        print_r($scanner->discover());
    } catch (\Exception $e) {
        print 'Exception: ' . $e->getMessage() . PHP_EOL;
    }
}

Discover only root devices

namespace CyberLine\phUPnP
{
    require 'src/Scanner.php';

    try {
        $scanner = new Scanner;
        $scanner
            ->setTimeout(1)
            ->setSearchType('upnp:rootdevice');

        print_r($scanner->discover());
    } catch (\Exception $e) {
        print 'Exception: ' . $e->getMessage() . PHP_EOL;
    }
}

Return json string from scanner

namespace CyberLine\phUPnP
{
    require 'src/Scanner.php';

    try {
        print json_encode(new Scanner);
    } catch (\Exception $e) {
        print 'Exception: ' . $e->getMessage() . PHP_EOL;
    }
}

About

PHP based uPNP Scanner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages