Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months ago
JSON representation
Validate if an ip address is public or private.
- Host: GitHub
- URL: https://github.com/laravel-validation-rules/ip
- Owner: laravel-validation-rules
- License: apache-2.0
- Created: 2017-09-09T20:22:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-28T16:43:53.000Z (almost 3 years ago)
- Last Synced: 2024-07-19T02:14:30.024Z (4 months ago)
- Topics: ip, laravel, rule, validation
- Language: PHP
- Size: 72.3 KB
- Stars: 15
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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],
]);
```