Libraries & Packages

Respect Validation: Validate PHP Input with Rules

Respect Validation offers a composable rule-based approach for validating values and application input.

Overview

Respect Validation is a PHP validation library built around reusable rules. It can help express requirements for strings, numbers, arrays, nested data and other common input types.

Where it helps

Validation is useful at application boundaries: contact forms, registration, API requests, configuration input and administrative forms. Centralized rules make requirements easier to test and maintain.

Using validation rules

Install the package with Composer, define rules that match the application's actual requirements and validate incoming values before business logic uses them. Keep validation separate from output escaping; valid input can still contain characters that must be escaped for HTML output.

Good practices

Validate on the server even when browser-side validation exists. Return understandable error messages without revealing internal implementation details, and use database constraints as an additional integrity layer.

Official resource

Respect Validation documentation

Share this page Help other developers discover this resource.