elife / api-validator
eLife Sciences API validator
Installs: 16 919
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 12
Forks: 0
Open Issues: 1
Requires
- php: ^7.0
- beberlei/assert: ^2.0
- guzzlehttp/psr7: ^1.0
- justinrainbow/json-schema: ^3.0 || ^4.0 || ^5.0
- psr/http-message: ^1.0
Requires (Dev)
- phpspec/phpspec: ^2.4
- phpspec/prophecy: ^1.5
- phpunit/phpunit: ^5.2
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-08-12 02:00:00 UTC
README
This library provides a validator for the eLife Sciences API.
It checks HTTP requests/responses to make sure that they match the specification. Currently only the body of the message is validated against the schema for that media type.
Dependencies
- Composer
- PHP 7
Installation
Execute composer require elife/api-validator:dev-master
.
Usage
To validate a message:
use eLife\ApiValidator\MessageValidator\JsonMessageValidator; use eLife\ApiValidator\SchemaFinder\PathBasedSchemaFinder; use JsonSchema\Validator; $messageValidator = new JsonMessageValidator(new PathBasedSchemaFinder('/path/to/api/schemas'), new Validator()); $messageValidator->validate($message);