Download the PHP package gilsegura/psr-validator without Composer
On this page you can find all versions of the php package gilsegura/psr-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gilsegura/psr-validator
More information about gilsegura/psr-validator
Files in gilsegura/psr-validator
Package psr-validator
Short Description This is a project providing infrastructure for validating PSR HTTP messages.
License MIT
Informations about the package psr-validator
PSR VALIDATOR
Framework-agnostic validation of PSR-7 messages against JSON Schema. It validates
requests, responses and server requests, composes validators into a chain, and
loads schemas from files or raw strings. The gilsegura/psr-messages-bundle
package uses it as the validation middleware in a controller pipeline.
Installation
Message validators
Each validator is an invokable that takes a PSR-7 message, validates it and
returns it (or throws a ValidationExceptionInterface on failure):
RequestValidator— validates an outgoingRequestInterface.ResponseValidator— validates aResponseInterface.ServerRequestValidator— validates an incomingServerRequestInterface.ValidatorChain— aMessageValidatorInterfacethat runs several validators in sequence, so request and response checks compose into one.
MessageValidatorInterface is the common contract (__invoke(MessageInterface): MessageInterface).
Schema validation
SchemaValidatorInterface/Schema\SchemaValidator— validate decoded data against a schema object, returning the list of violations;ValidatorExceptionsurfaces a schema-level failure.Exception\ValidationExceptionInterface— the marker validation failures implement, so callers catch a single type regardless of which part failed.
Schema factories
A schema factory builds the schema object the validators check against:
SchemaFactoryInterface— the contract; an invokable returning the schema.SchemaFactory\FileFactory— loads a JSON Schema from a.jsonfile.SchemaFactory\RawFactory— builds a schema from a raw string.SchemaFactory\SchemaFactoryException— raised when a schema cannot be built.
Middleware (PSR-15)
Middleware\ValidationMiddleware validates a message as part of a PSR-15
pipeline, so validation runs inline with the request flow rather than being
called by hand.
License
MIT. See LICENSE.
All versions of psr-validator with dependencies
opis/json-schema Version ^2.3
psr/http-message Version ^2.0
psr/http-server-middleware Version ^1.0