risan / lara-rules

Laravel custom validation rules.

Repository from Github https://github.comrisan/lara-rulesRepository from Github https://github.comrisan/lara-rules

Lara Rules

Laravel custom validation rules.

Latest Stable Version License

Installation

This package requires you to use Laravel version 8. Install this package through Composer.

$ composer require risan/lara-rules

Usage

use Risan\LaraRules\USPhoneWithDash;

$request->validate([
    'phone' => ['required', 'string', new USPhoneWithDash], // Valid: 123-456-7890
    'state' => ['required', 'string', new USStateCode], // Valid: CA, TX
    'zip_code' => ['required', 'string', new USZipCode], // Valid: 90120 or 20521-9000
]);
  • USPhoneWithDash: 10 digits of US phone number with dash.
  • USStateCode: 2 characters of US state code.
  • USZipCode: 5 or 9 digits of US zip code.

License

MIT © Risan Bagja Pradana

About

Laravel custom validation rules.

License:MIT License


Languages

Language:PHP 100.0%