Validate if an ip address is public or private.
29,634
15
4
Package Data
Maintainer Username: clarkeash
Maintainer Contact: me@ashleyclarke.me (Ashley Clarke)
Package Create Date: 2017-09-09
Package Last Update: 2021-12-28
Language: PHP
License: Apache-2.0
Last Refreshed: 2025-01-14 15:09:25
Package Statistics
Total Downloads: 29,634
Monthly Downloads: 43
Daily Downloads: 0
Total Stars: 15
Total Watchers: 4
Total Forks: 3
Total Open Issues: 0

IP

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