lablnet/validation

PHP Validation package.

1.0 2018-08-19 08:08 UTC

This package is auto-updated.

Last update: 2024-11-09 15:45:00 UTC


README

Requirement

  • PHP
  • Composer

install

run this command composer require lablnet/validation

usage

<?php 
    require __DIR__.'/vendor/autoload.php'; 

	$rules = [
		'username' => ['required' => true, ],
		'email' => ['required' => true],
		'password' => ['required' => true, ],
	];
	$validation = new \Lablnet\Validation($_POST,$rules,'input');
	if($validation->fail()){
		$errors = $validation->error()->get();

		foreach ($errors as $error) {
			foreach ($error as $value) {
				echo $value."<br>";
			}
		}
	} else {
		//TO-Do create the user
    }