Search by

elife / api-validator

scottaubrey

eLife Sciences API validator

Package info

github.com/elifesciences/api-validator-php

pkg:composer/elife/api-validator

Statistics

Installs: 31 643

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 8

v1.1.0 2024-10-25 05:29 UTC

This package is auto-updated.

Last update: 2026-09-09 20:32:42 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

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);