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.