Validate if an ip address is public or private.

1.6.0 2021-12-28 16:43 UTC

This package is auto-updated.

Last update: 2024-08-28 22:32:20 UTC


README

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

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],
]);