Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laravel-validation-rules/ip

Validate if an ip address is public or private.
https://github.com/laravel-validation-rules/ip

ip laravel rule validation

Last synced: about 2 months ago
JSON representation

Validate if an ip address is public or private.

Awesome Lists containing this project

README

        

# IP

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














## Installation

```bash
composer require laravel-validation-rules/ip
```

## Usage

Validate an ip address is a public address.

```php
use LVR\IP\PublicAddress;

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

Validate an ip address is a private address.

```php
use LVR\IP\PrivateAddress;

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