Git Product home page Git Product logo

laravel-netutils's Introduction

Network Utilities for Laravel

Donate Latest Stable Version Total Downloads Monthly Downloads Latest Unstable Version License

PHP Library for Networking Tools (IPv4 and IPv6) Use for Laravel 5

Install

Via Composer

$ composer require sentrasoft/laravel-netutils

Via edit composer.json

"require": {
	"sentrasoft/laravel-netutils": "dev-master"
}

Next, update Composer from the Terminal:

$ composer update

Add to laravel config

Once this operation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array.

'providers' => array(
    .....
    Sentrasoft\Netutils\NetutilsServiceProvider::class,
);

Now add the alias.

'aliases' => array(
    ......
    'Netutils' => Sentrasoft\Netutils\Facades\Netutils::class,
);

Usage

// Generate network object
$network = new Netutils;
// The default IP set to 127.0.0.1 and Netmask 255.255.255.0

// Set the IP and Netmask
$network::setIP('10.3.30.179');
$network::setNetmask('255.255.255.0');

// Get the IP and Netmask
$ip = $network::getIP();
$netmask = $network::getNetmask();

// Get Ping latency from current IP set
$latency = $network::ping()->ping();

// Get Ping latency from given ip
$latency = $network::ping('192.168.1.123')->ping();

// Get Network info from current IP set
$network = $network::network()->info;

// Get Network info from given IP and Netmask
$network = $network::network('192.168.1.123','255.255.255.0')->info;

// Get individual Network info
$CIDR = Network::network()->CIDR;
$broadcast = (string)Network::network()->broadcast;

// Get MAC address from target's IP
$mac = $network::network()->mac;

// Bonus Wake On Lan
// Netutils::WakeOnLan('Mac Address','Broadcast Address')->WakeUp();
$wakeOnLan = $network::WakeOnLan('74-27-ea-5e-74-59','10.3.30.255')->WakeUp();

Support Us

Donate

Help us to keep making awesome stuff. You don't have to be a developer to support our open source work. If you want to receive personal support, or just feel all warm and fuzzy inside from helping open source development, donations are very welcome. Thank you.

License

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

laravel-netutils's People

Contributors

beonami avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.