Download the PHP package openapi-tools/generator-hydrator without Composer

On this page you can find all versions of the php package openapi-tools/generator-hydrator. 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 generator-hydrator

generator-hydrator

FileGenerator for OpenAPI Tools that emits EventSauce ObjectHydrator mappers for generated schema classes. Each path (and optionally each webhook) gets a dedicated hydrator; a central Internal\Hydrators facade implements ObjectMapper and routes by class name.

Continuous Integration Latest Stable Version Total Downloads License

Installation

Where it fits

This package runs during step 4 of the OpenAPI Tools pipeline — after generator-schema has emitted the schema classes this generator reflects on:

Register Hydrator after Schema. The generator run loop include_onces each written file so later generators can depend on freshly emitted types; this generator uses ReflectionMethod on schema constructors when deciding which classes to pass to ObjectMapperCodeGenerator.

Components

Class Purpose
Hydrator Entry-point FileGenerator; emits per-scope hydrators and the central Internal\Hydrators facade

AST construction delegates to generator-utils (ExpressionBuilder, MatchBuilder, StatementBuilder). Hydration and serialization logic is produced by EventSauce's ObjectMapperCodeGenerator.

Usage

Hydrator takes a shared nikic/php-parser BuilderFactory and a flag controlling webhook hydrators. Attach it to a package's generators list after Schema:

Set includeWebHookHydrators to false when the package has no webhooks or when another generator (such as generator-psr-15-webhook-middleware) owns webhook hydration.

A full configuration example lives in openapi-tools/generator.

Direct invocation

Useful in tests and custom tooling:

Generation order

Hydrator::generate() walks hydrators from the namespaced representation:

  1. Path hydrators — one per entry in $representation->client->paths.
  2. Webhook hydrators — one per entry in $representation->webHooks when includeWebHookHydrators is true.

For each scope it yields a dedicated ObjectMapper class, then yields the shared Internal\Hydrators facade last.

Within each per-scope hydrator, only schema classes whose __construct has at least one parameter are passed to ObjectMapperCodeGenerator. Schemas without constructor parameters are omitted from the generated mapper.

Output layout

Given namespace ApiClients\Client\Example and a single root path operation:

Relative path Kind
Internal/Hydrator/Operation/Root.php Per-path ObjectMapper for schemas used on that path
Internal/Hydrators.php Central facade implementing ObjectMapper

Webhook scopes use Internal/Hydrator/WebHook/{Name}.php instead of Operation/….

Generated code

Per-scope hydrators

Each hydrator is a class generated by EventSauce's ObjectMapperCodeGenerator. It implements ObjectMapper with optimized hydrateObject, hydrateObjects, serializeObject, and serializeObjects methods — no reflection at runtime. Custom value types (such as Ramsey\Uuid\UuidInterface) get dedicated serialize helpers.

Central facade

Internal\Hydrators implements ObjectMapper and delegates to the per-scope hydrators. Schemas shared across paths appear once in the routing match, even when multiple hydrators reference them.

Lazy getters initialize each per-scope mapper on first use:

Method names on the facade mirror the hydrator methodName from the representation (for example Operation🌀Root, WebHook🪝Ping).

Schema deduplication

When the same schema class is collected by more than one path or webhook hydrator, the central Internal\Hydrators match includes it only once. Per-scope hydrators still list every schema they need; deduplication applies only to the facade's class-name routing.

Supported patterns

Behaviour is locked down through shared fixtures in openapi-tools/test-data. Each YAML file has a matching assertion class under tests/DataTests/.

Fixture What it exercises
Basic Minimal object, $ref, UUID format, response headers
ExampleData Scalars, formats, patterns, arrays, nullable unions
Aliases Structurally identical inline objects → alias classes hydrated by one mapper
NestedSchema Inline nested objects without $ref
NestedReferenceSchema Nested objects via component $ref
TripleNestedSchema Deep nesting with $ref on nested schema keyword
DoubleUseOfTypes OpenAPI 3.1 type array combined with anyOf on one property
BasicWebHooks Separate hydrators per webhook event
DiscriminatedWebHooks Webhook payload with discriminated request-body variants
MultiVariantWebHooks One webhook mapping to multiple schema variants

Run the suite:

For the full fixture roadmap and situation coverage matrix, see test-data/src/DataSets/PLAN.md.

Related packages

Package Relationship
contract FileGenerator and Package interfaces
representation Input model (Namespaced\Hydrator, path and webhook hydrator metadata)
gatherer Builds the representation and assigns schemas to path/webhook hydrators
generator-schema Must run before this package
generator-utils AST builders used for the facade class
generator CLI and run loop that orchestrates all generators
eventsauce/object-hydrator Runtime ObjectMapper interface and code generator

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT)

Copyright (c) 2026 Cees-Jan Kiewiet

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


All versions of generator-hydrator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
eventsauce/object-hydrator Version ^1.5
nikic/php-parser Version ^5.0
openapi-tools/contract Version ^0.1.0
openapi-tools/generator-utils Version ^0.1.0
openapi-tools/representation Version ^0.1.0
openapi-tools/utils Version ^0.1.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 openapi-tools/generator-hydrator contains the following files

Loading the files please wait ...