2017 © Pedro Peláez
 

library network

Network helpers

image

vjandrea/network

Network helpers

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Network helpers

This is a work-in-progress collection of functions useful for storing network data in a database. The available methods are:, (*1)

mac2long - Converts a MAC address in a long int. Default separators are ':' and '-', (*2)

long2mac - Converts a long int into a MAC address. Default separator is ':', (*3)

Installation

Add "vjandrea/network" to your project's composer.json., (*4)

"require": {
    "vjandrea/network": "dev-master"
},
"minimum-stability" : "dev"

Then update via composer, (*5)

composer update

Usage examples

Remember to add use VJAndrea\Network; when you want to use the function provided by this helper., (*6)

Example: i want to convert a MAC address to an integer for easier database storage:, (*7)

$mac = '01-23-45-67-89-0A';

$long = Network::mac2long($mac); // $long value now is 1250999896330

Example: i want to take a MAC address that i saved as integer in the db and format it properly for the user:, (*8)

$long = 1250999896330;

$mac = Network::long2mac($long); // $mac value now is '01:23:45:67:89:0A'

The Versions

02/03 2014

dev-master

9999999-dev

Network helpers

  Sources   Download

MIT

The Requires

  • php >=5.3.0