Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

StyleShit/zod-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

13 Commits

Repository files navigation

Zod-PHP

A Zod-like implementation in PHP, inspired by Laravel's code standards.

Usage:

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.

About

A Zod-like implementation in PHP, inspired by Laravel's code standards.

Resources

Stars

Watchers

Forks

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /