PHPackages                             apie/schema-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. apie/schema-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

apie/schema-generator
=====================

Composer package of the apie library: schema generator

1.0.0.x-dev(3mo ago)07.1k3MITPHPPHP &gt;=8.3

Since May 3Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/apie-lib/schema-generator)[ Packagist](https://packagist.org/packages/apie/schema-generator)[ RSS](/packages/apie-schema-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (11)Versions (3)Used By (3)

[![](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)](https://raw.githubusercontent.com/apie-lib/apie-lib-monorepo/main/docs/apie-logo.svg)

schema-generator
================

[](#schema-generator)

[![Latest Stable Version](https://camo.githubusercontent.com/55b459a529164c63fb7b44357d102eba0cc23f0ca61aef52da4bfefef7744513/68747470733a2f2f706f7365722e707567782e6f72672f617069652f736368656d612d67656e657261746f722f76)](https://packagist.org/packages/apie/schema-generator) [![Total Downloads](https://camo.githubusercontent.com/510658a1d9b526a3568cbdd742bd0874452bad7f2d1bd272b519903026faa15f/68747470733a2f2f706f7365722e707567782e6f72672f617069652f736368656d612d67656e657261746f722f646f776e6c6f616473)](https://packagist.org/packages/apie/schema-generator) [![Latest Unstable Version](https://camo.githubusercontent.com/566f368d4f5fe74df3008b03d15af2c0854ea3f88adc0d1c605baa35921a38f8/68747470733a2f2f706f7365722e707567782e6f72672f617069652f736368656d612d67656e657261746f722f762f756e737461626c65)](https://packagist.org/packages/apie/schema-generator) [![License](https://camo.githubusercontent.com/f1512c68f537a5d315bfde4d3db60a7b9a1825c1145c70113ab7f926a2e4a92b/68747470733a2f2f706f7365722e707567782e6f72672f617069652f736368656d612d67656e657261746f722f6c6963656e7365)](https://packagist.org/packages/apie/schema-generator) [![PHP Composer](https://camo.githubusercontent.com/963999a3e64288e3cb2e7e8683d6184ecc94c2e8ecc896bd849c8ad7068b411c/68747470733a2f2f617069652d6c69622e6769746875622e696f2f70726f6a656374436f7665726167652f636f7665726167652d736368656d612d67656e657261746f722e737667)](https://apie-lib.github.io/projectCoverage/schema-generator/index.html)

[![PHP Composer](https://github.com/apie-lib/schema-generator/actions/workflows/php.yml/badge.svg?event=push)](https://github.com/apie-lib/schema-generator/actions/workflows/php.yml)

This package is part of the [Apie](https://github.com/apie-lib) library. The code is maintained in a monorepo, so PR's need to be sent to the [monorepo](https://github.com/apie-lib/apie-lib-monorepo/pulls)

Documentation
-------------

[](#documentation)

The schema generator creates a JSON Schema from an object with typehints. It supports entities, lists, hashmaps, value objects and DTO made for Apie. It returns objects made with the library [cebe/php-openapi](https://github.com/cebe/php-openapi).

This library does not generate an entire OpenAPI schema, but instead it just creates the JSON schema section of all the objects.

### Standard usage

[](#standard-usage)

In general you make multiple schemas for multiple objects with references. Because of that we basically create a [Components section](https://spec.openapis.org/oas/v3.1.0#components-object)

Code example:

```
