Skip to content
This repository was archived by the owner on Dec 15, 2025. It is now read-only.

Release v2.0.0 - HTTP validation, i18n, and namespace change

Latest

Choose a tag to compare

@michelphp michelphp released this 07 Dec 18:26
· 1 commit to main since this release

This major release introduces a new namespace, a full internationalization system, and powerful features for validating HTTP requests, headers, and forms.

BREAKING CHANGE: The root namespace has been changed from PhpDevCommunity\RequestKit to Depo\RequestKit. All use statements in projects using this library must be updated.

Features:

HTTP Request Handling:

  • withHeaders(): A new method in AbstractSchema to define validation rules for incoming HTTP headers (e.g., API keys, Content-Type).
  • processFormHttpRequest(): A new method in AbstractSchema to securely process form submissions.
  • CSRF Protection: The processFormHttpRequest method includes optional, secure CSRF token validation to prevent cross-site request forgery attacks.

Core Validation:

  • equals(): A generic constraint has been added to AbstractType, allowing any data type to be checked for strict equality against a specific value.

Internationalization (i18n):

  • A new Locale class now manages all error messages, allowing for easy translation.
  • The library now ships with built-in translations for English ('en') and French ('fr').

Improvements & Fixes:

  • Security: The error message for the equals() constraint no longer reveals the expected value, preventing potential secret leakage.
  • Refactoring: The entire library has been moved under the Depo vendor namespace for better project identity.
  • Dependency Removal: The dependency on phpdevcommunity/validator has been removed, making the library fully self-contained.
  • Testing: Added comprehensive unit tests for all new features, including equals, withHeaders, processFormHttpRequest, and the Locale system.
  • Documentation: The README.md has been significantly updated with examples and explanations for all new features.