2017 © Pedro Peláez
 

library randomip

Generate a random IPv4 address.

image

gregorj/randomip

Generate a random IPv4 address.

  • Saturday, August 26, 2017
  • by grej
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Random IP generator for private IPv4 networks

Generate a random private IPv4 subnet of specific size (bitmask), or pick a random address from a defined private IPv4 network., (*1)

Usage

Require the class in your own project using composer:, (*2)

composer require gregorj/randomip

The static functions can be called easily in your code:, (*3)


//echos a random class B (172.[16-31].0.0/12) network for 6 hosts. echo \GregorJ\RandomIP\RandomPrivateIPv4::randomNetwork('B', 29); //echos a random IP address inside the network 192.168.21.0/24 echo \GregorJ\RandomIP\RandomPrivateIPv4::randomIP("192.168.21.0", 24);

Restriction

This code is only suitable for private IPv4 networks. Therefore the bitmask cannot be lower than the following:, (*4)

Class Starting address minimum bitmask
A 10.0.0.0 8
B 172.16.0.0 12
C 192.168.0.0 16

The Versions

26/08 2017

dev-master

9999999-dev

Generate a random IPv4 address.

  Sources   Download

MIT

The Requires

 

26/08 2017

1.0.0

1.0.0.0

Generate a random IPv4 address.

  Sources   Download

MIT

The Requires