Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 651 Bytes

01-get-started.md

File metadata and controls

32 lines (21 loc) · 651 Bytes

Get Started

Requirements

  • PHP 8.1 or higher.

Installation

Install the library via Composer:

composer require programmatordev/yet-another-php-validator

Basic Usage

Simple usage looks like:

use ProgrammatorDev\Validator\Validator;

// do this:
$validator = Validator::type('int')->greaterThanOrEqual(18);

// and validate with these:
$validator->validate(16); // returns bool: false
$validator->assert(16, 'age'); // throws exception: The age value should be greater than or equal to 18.