nette/schema
Nette Schema is a lightweight PHP library for validating and normalizing structured data. Define schemas to check arrays and objects, coerce values, and generate clear error messages for configs, APIs, and form input.
nette/schema converts a recurring "write bespoke validation for this new integration" line item into a small, maintained dependency — freeing engineering capacity for roadmap features instead of validation internals.database.host) move those failures to bootstrap, where they're caught in CI or at deploy rather than in production traffic.castTo() lets validated payloads land directly in domain objects, which shortens the path from "new endpoint" to "shippable" and shrinks the class of bugs caused by loosely-typed arrays flowing through the codebase.merge() / extend()), deterministic config output for caching/diffing (skipDefaults()), and machine-readable error codes (required, type.string) that make localized, frontend-safe error messaging a configuration task rather than a code task.Adopt when:
Validator rules become an unreadable array of dot-keys and wildcards.'TRUE' coerced to true, validated output shaped into DTOs.Look elsewhere when:
FormRequest, authorize(), redirect-with-errors, and Blade error bags. Keep Laravel's Validator for that; layering two validation systems on one endpoint is a maintenance tax, not a feature.NOASSERTION, which typically means GitHub could not auto-detect a standard license file. Confirm the actual terms (Nette libraries are generally BSD-3-Clause) before it enters a distributed or commercial product — this is a one-hour legal check, not a blocker, but do it before the sprint, not after.To executives — the one-paragraph version:
We handle a growing amount of configuration and inbound data from systems we don't control, and our current approach validates it ad hoc, in code written per integration. That's slow to build and slow to debug: bad values surface as runtime failures far from their source. nette/schema is a small, mature, actively maintained PHP library that lets us declare the shape of that data once and enforce it automatically — catching problems at deploy time instead of in production, and removing validation boilerplate from every new integration we ship. It's a buy-not-build decision with a modest footprint and a clear failure mode: if it disappoints, the schemas are plain PHP and can be replaced incrementally. Two asks: confirm the license terms, and fund a small internal wrapper so the integration stays consistent across teams.
To engineering — the summary:
Declarative schema validation for nested PHP data, framework-agnostic, PHP 8.1+, current release dated 2026-08-17, static-analysis-clean. We use it for config bootstrapping and non-HTTP payload contracts; we keep Laravel's Validator for user-facing form requests and don't mix the two on one endpoint. What we get: defaults and normalization, structured errors with dot-path context and stable error codes, castTo() for DTO mapping, and merge()/extend() for environment-layered config. What we take on: we write and own the Laravel glue (service provider, config-loading hook, error-code-to-message mapping) as a thin internal package; there's no first-party Laravel support to lean on. Known traps to encode in our wrapper so nobody rediscovers them: Expect::array() vs. listOf() (silent key stripping on lists), defaults not applying to explicit null, and AnyOf([]) throwing. One prerequisite: a short legal check on the NOASSERTION license designation, and a decision on PHP 8.1 as a floor if any service is still below it.
How can I help you explore Laravel packages today?