Skip to content

v1.1.0: Core Schemas Expansion & PHP Enum Support

Choose a tag to compare

@ghostzero ghostzero released this 18 Apr 13:50
· 4 commits to main since this release

What's Changed in v1.1.0

This release brings massive feature parity updates with the official Zod JS library, introducing a host of new core schemas, deep PHP native Enum support, and dozens of new validation methods for strings, numbers, and objects.

✨ New Features

  • New Core Schemas: Added support for Z::bigint(), Z::date(), Z::void(), Z::undefined(), Z::nan(), Z::map(), Z::set(), Z::discriminatedUnion(), and Z::pipeline().
  • PHP Native Enum Support: Introduced Z::nativeEnum() and enhanced Z::enum() to natively support PHP 8.1 BackedEnum and UnitEnum instances alongside standard string literals.
  • ISO Validation Utility: Added a new Z::iso() utility with built-in validation helpers for .date(), .time(), and .datetime().

🚀 Schema Enhancements

  • Base Schema: Added fluent composition methods .or(), .and(), and .pipe().
  • String Validations: Massively expanded string schema capabilities with .trim(), .toLowerCase()/.lowercase(), .toUpperCase()/.uppercase(), .startsWith(), .endsWith(), .includes(), .url(), .uuid(), .ip() (including IPv4/IPv6 specific options), .cidr(), and .base64().
  • Number Validations: Introduced strictly exclusive limiters .gt() and .lt(), as well as a .safe() integer range checker.
  • Object Methods: Added standard object manipulation tools: .merge(), .pick(), .omit(), .partial(), .required(), and .keyof().
  • Array Methods: Added the .element() method to easily retrieve the underlying element schema.
  • Optional Schema: Improved parsing logic to cleanly and safely handle explicit null inputs.

✅ Testing & Internal

  • Test Coverage: Added comprehensive test suites for BigIntSchema, DateSchema, MapSchema, NanSchema, SetSchema, VoidSchema, Iso, and all newly added schema methods.
  • Feature Tracking: Added a checklist.md to map and track ongoing feature parity with the JS Zod library.
  • Dependencies: Locked project dependencies via composer.lock and updated .gitignore.

Full Changelog: 1.0.0...1.1.0