henningcullin/php-form-validation

Lightweight PHP form validation library inspired by Fomantic UI.

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/henningcullin/php-form-validation

v0.1.0 2025-10-14 19:11 UTC

This package is auto-updated.

Last update: 2025-10-14 19:15:34 UTC


README

Lightweight PHP form validation library inspired by Fomantic UI.
Supports fields, rules, custom validation, and JSON export.

⚠️ Warning: This library is in early development (pre-1.0).
APIs and behavior may change without notice. Use at your own risk.

Installation

Using composer:

composer require henningcullin/php-form-validation

Usage

require 'vendor/autoload.php';

use FormValidation\Schema;
use FormValidation\Field;
use FormValidation\Rules\RuleEmail;

$field = Field::new('email')
    ->add_rule(RuleEmail::new('Invalid email'));

$schema = Schema::new()
    ->add_field($field);

$data = ['email' => 'test@example.com'];
$result = $schema->validate($data);

if ($result->is_ok()) {
    echo "All good!";
} else {
    print_r($result->get_errors());
}