Validate if an ip address is public or private.

1.4.0 2020-09-16 18:14 UTC

This package is auto-updated.

Last update: 2020-11-16 18:33:40 UTC


README

Validates an ip address is either public or private. Supports ipv4 & ipv6.

68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c61726176656c2d76616c69646174696f6e2d72756c65732f69702e7376673f7374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6c61726176656c2d76616c69646174696f6e2d72756c65732f69702e7376673f7374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c61726176656c2d76616c69646174696f6e2d72756c65732f69702e7376673f7374796c653d666c61742d737175617265 68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6c61726176656c2d76616c69646174696f6e2d72756c65732f69702e7376673f7374796c653d666c61742d737175617265

Installation

composer require laravel-validation-rules/ip

Usage

Validate an ip address is a public address.

use LVR\IP\PublicAddress;

$request->validate([
    'ip' => ['required', new PublicAddress],
]);

Validate an ip address is a private address.

use LVR\IP\PrivateAddress;

$request->validate([
    'ip' => ['required', new PrivateAddress],
]);