datasift/netifaces

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (0.1.0) of this package.

0.1.0 2013-08-09 17:13 UTC

This package is not auto-updated.

Last update: 2023-12-05 01:04:05 UTC


README

Installation

Add the following to your composer.json file

{
    "requires": {
        "datasift/netifaces": "*"
    }
}

Usage

We currently support two methods, listAdapters() and getIpAddress().

require __DIR__.'/../vendor/autoload.php';

// To get information about our network adapters, we need to know about two things
// 1. The OS that we're on
$os = Datasift\Os::getOs();
// 2. We need a parser for the ifconfig output
$parser = Datasift\IfconfigParser::fromDistributions($os->getPossibleClassNames());

// Next, we create a new netifaces instance, passing in our OS and Parser
$netifaces = new Datasift\netifaces($os, $parser);

// Then we can list the available adapters
var_dump($netifaces->listAdapters());

// Or get the IP address if a specific adapter
var_dump($netifaces->getIpAddress("eth0"));