Download the PHP package duyler/openapi without Composer

On this page you can find all versions of the php package duyler/openapi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openapi

Duyler OpenAPI Validator

Quality Gate Status Coverage type-coverage psalm-level PHP Version Ask DeepWiki

OpenAPI 3.2 validator for PHP 8.4+

Features

Installation

Quick Start

Basic Usage

Usage

Loading OpenAPI Specifications

PSR-7 Integration

The validator works with any PSR-7 implementation:

Caching

Enable PSR-6 caching for improved performance:

Events

Subscribe to validation events using PSR-14:

Webhooks

Validate webhook requests:

Advanced Usage

Custom Format Validators

Register custom format validators for domain-specific validation:

Type Coercion

Enable automatic type conversion for query parameters and request body:

Error Formatters

Choose from built-in error formatters or create your own:

Discriminator Validation

Validate polymorphic schemas with discriminators:

Event-Driven Validation

Subscribe to validation lifecycle events:

Schema Registry

Manage multiple API versions:

Validator Pool

The validator pool uses WeakMap to reuse validator instances:

Validator Compilation

Generate optimized validator code:

Configuration Options

Builder Methods

Method Description Default
fromYamlFile(string $path) Load spec from YAML file -
fromJsonFile(string $path) Load spec from JSON file -
fromYamlString(string $content) Load spec from YAML string -
fromJsonString(string $content) Load spec from JSON string -
withCache(SchemaCache $cache) Enable PSR-6 caching null
withEventDispatcher(EventDispatcherInterface $dispatcher) Set PSR-14 event dispatcher null
withErrorFormatter(ErrorFormatterInterface $formatter) Set error formatter SimpleFormatter
withFormat(string $type, string $format, FormatValidatorInterface $validator) Register custom format -
withValidatorPool(ValidatorPool $pool) Set custom validator pool new ValidatorPool()
withLogger(object $logger) Set PSR-3 logger null
withEmptyArrayStrategy(EmptyArrayStrategy $strategy) Set empty array validation strategy AllowBoth
enableCoercion() Enable type coercion false
enableNullableAsType() Enable nullable validation (default: true) true
disableNullableAsType() Disable nullable validation false

Example Configuration

Supported JSON Schema Keywords

The validator supports the following JSON Schema draft 2020-12 keywords:

Type Validation

Nullable Validation

By default, the nullable: true schema keyword allows null values for a property:

This behavior is enabled by default. To disable nullable validation and treat nullable: true as not allowing null values:

String Validation

Pattern Validation

All regular expressions in schemas are validated during schema parsing. If a pattern is invalid, an InvalidPatternException is thrown.

Supported Pattern Fields

Pattern Delimiters

The library automatically adds delimiters (/) to patterns without them. You can specify patterns with or without delimiters:

Both variants work identically.

Pattern Validation Errors

Invalid patterns are detected early and throw descriptive errors:

Numeric Validation

Array Validation

Object Validation

Composition Keywords

Advanced Keywords

Error Handling

Validation Exceptions

All validation errors throw ValidationException which contains detailed error information:

Common Validation Errors

Error Type Description
TypeMismatchError Data type doesn't match schema type
RequiredError Required property is missing
MinLengthError / MaxLengthError String length constraint violation
MinimumError / MaximumError Numeric range constraint violation
PatternMismatchError Regular expression pattern violation
InvalidFormatException Format validation failed (email, URI, etc.)
OneOfError / AnyOfError Composition constraint violation
EnumError Value not in allowed enum
MissingParameterException Required parameter is missing
UnsupportedMediaTypeException Content-Type not supported

Error Formatters

Choose the appropriate error formatter for your use case:

Built-in Format Validators

The following format validators are included:

String Formats

Format Description Example
date-time ISO 8601 date-time 2026-01-15T10:30:00Z
date ISO 8601 date 2026-01-15
time ISO 8601 time 10:30:00Z
email Email address [email protected]
uri URI https://example.com
uuid UUID 550e8400-e29b-41d4-a716-446655440000
hostname Hostname example.com
ipv4 IPv4 address 192.168.1.1
ipv6 IPv6 address 2001:db8::1
byte Base64-encoded data SGVsbG8gd29ybGQ=
duration ISO 8601 duration P3Y6M4DT12H30M5S
json-pointer JSON Pointer /path/to/value
relative-json-pointer Relative JSON Pointer 1/property

Numeric Formats

Format Description Example
float Floating-point number 3.14
double Double-precision number 3.14159265359

Overriding Built-in Validators

Replace built-in validators with custom implementations:

Migration from league/openapi-psr7-validator

Key Differences

Feature league/openapi-psr7-validator duyler/openapi
PHP Version PHP 7.4+ PHP 8.4+
OpenAPI Version 3.0 3.0, 3.1, 3.2
JSON Schema Draft 7 Draft 2020-12
Builder Pattern Fluent builder Fluent builder (immutable)
Type Coercion Enabled by default Opt-in
Error Formatting Basic Multiple formatters

Migration Examples

Before (league/openapi-psr7-validator)

After (duyler/openapi)

Requirements

Testing

License

MIT


All versions of openapi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
nyholm/psr7 Version ^1.8
psr/cache Version ^3.0
psr/event-dispatcher Version ^1.0
psr/http-message Version ^2.0
symfony/yaml Version ^7.0 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package duyler/openapi contains the following files

Loading the files please wait ...