一覧へ戻る
StyleShit/zod-php(新しいタブで開きます)
主要言語: PHP
A Zod-like implementation in PHP, inspired by Laravel's code standards.
- star 数
- 31
- watcher 数
- 1
- fork 数
- 6
- issue 数
- 1
- 最終更新
- 2024/02/09
主要言語: PHP
A Zod-like implementation in PHP, inspired by Laravel's code standards.
A Zod-like implementation in PHP, inspired by Laravel's code standards.
The usage is pretty simple & straightforward, and is very similar to the original Zod library:
use StyleShit\Zod\Zod as Z; // Create the schema. $schema = Z::object([ 'name' => Z::string()->min(3)->max(15), 'age' => Z::number()->min(0), 'address' => Z::object([ 'city' => Z::string(), 'street' => Z::string(), ]), ]); // Validate the data. $parsed = $schema->parse([ 'name' => 'John Doe', 'age' => 20, 'address' => [ 'city' => 'New York', 'street' => 'Wall Street', ], ]);
For more information, see the tests.