attributes-php / strictify-ext
Pydantic-inspired PHP library for validating data via type hints at lightning speed ⚡️
Package info
github.com/Attributes-PHP/strictify-ext
Language:C
Type:php-ext
Ext name:ext-attributes-strictify
pkg:composer/attributes-php/strictify-ext
Requires
- php: ^8.2
Requires (Dev)
- carthage-software/mago: ^1.50.0
- illuminate/translation: ^12.0 || ^13.0
- illuminate/validation: ^12.0 || ^13.0
- pestphp/pest: ^3.0
- phpbench/phpbench: ^1.7
- respect/validation: ^2.5 || ^3.0
- symfony/validator: ^7.4 || ^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v1.0.0
- dev-vibe/constraints-respect-parity-df3acd
- dev-vibe/constraints-edge-case-tests
- dev-vibe/docs-constants-bf4b94
- dev-vibe/type-constants-t-prefix-bf4b94
- dev-vibe/docs-overhaul-1aa232
- dev-vibe/todict-use-alias-1aa232
- dev-vibe/docs-todict-use-alias-1aa232
- dev-vibe/add-architecture-docs-a54fe0
- dev-vibe/add-contributing-docs-a54fe0
- dev-vibe/add-php-integration-tests-a54fe0
- dev-vibe/add-c-unit-tests-a54fe0
- dev-vibe/implement-core-validation-logic-a54fe0
- dev-vibe/fix-memory-leaks-validate-function-a54fe0
- dev-fix-segfault-double-free
- dev-vibe/fix-memory-double-free
- dev-vibe/feat-add-validation-rule-stubs
- dev-vibe/test-add-modelconfigs-tests
This package is auto-updated.
Last update: 2026-11-27 17:54:02 UTC
README
Strictify Extension is a Pydantic-inspired PHP library for validating data via type hints at lightning speed ⚡️ It shares its API, behavior and documentation with strictify, the pure-PHP Composer flavor of the same library: same models, same functions — the extension just runs them at native speed.
Prerequisites
- PHP 8.2 or later
We aim to support versions that haven't reached their end-of-life.
How it works?
<?php use function Attributes\Strictify\validate; use Attributes\Strictify\BaseModel; class User extends BaseModel { public float|int $age; public ?DateTime $birthday; } $rawData = [ 'age' => 30, 'birthday' => '1994-01-01T09:00:00+00:00', ]; $user = validate($rawData, new User()); var_dump($user->age); // int(30) var_dump($user->birthday); // object(DateTime) { ["date"] => string(26) "1994-01-01 09:00:00.000000", (...) }
Need to call a function?
<?php use function Attributes\Strictify\call; function myFunction(User $user) { var_dump($user->age); // int(30) var_dump($user->birthday); // object(DateTime) { ["date"] => string(26) "1994-01-01 09:00:00.000000", (...) } } call("myFunction", $rawData);
Installation
pie install attributes-php/strictify-ext
For the widest compatibility — including shared hosting and managed platforms where PHP extensions cannot be installed — use the pure-PHP flavor instead, which requires no code changes:
composer require attributes-php/strictify
Documentation
Full documentation lives at strictify.attributes-php.com:
- Quickstart — first model and first validation in under a minute
- Guides — validating payloads, nested models, aliases, error messages, sensitive data,
call(),toDict() - Reference —
validate(),toDict(),call(),ModelConfigs, constraints, exceptions, API - Benchmarks, FAQ and Changelog
- For LLMs and agents: llms.txt indexes every page (each also served as Markdown), and llms-full.txt has the full docs in one file
Strictify Extension was created by André Gil and is open-sourced software licensed under the MIT license.
