PHPackages                             typeschema/reflection - 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. typeschema/reflection

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

typeschema/reflection
=====================

This library helps to generate a TypeSchema specification using reflection

v0.1.0(1y ago)21MITPHP

Since Dec 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/apioo/typeschema-reflection-php)[ Packagist](https://packagist.org/packages/typeschema/reflection)[ Docs](https://typeschema.org/)[ Fund](https://www.paypal.me/fusioapi)[ GitHub Sponsors](https://github.com/chriskapp)[ RSS](/packages/typeschema-reflection/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

About
=====

[](#about)

This library provides a fully level 5 compliant reflector class to automatically build a [TypeSchema](https://typeschema.org/)specification based on a class using reflection. Through this you can easily transform your DTO classes into a TypeSchema specification.

Since the TypeSchema specification contains all information of each DTO you can transform the spec again back into DTO classes or also any other output which is supported by TypeSchema. This can help to re-use your DTO classes in different environments or also to generate other specifications.

Level 5 compliant means that this library supports all features of TypeSchema and you can transform your Java-Class into a TypeSchema specification and then use the TypeSchema specification to generate a Java-Class which can be again turned into a TypeSchema specification without any information loss.

```
       Reflector       Generator       Reflector
           |               |               |
PHP Class ---> TypeSchema ---> PHP Class ---> TypeSchema

```

In this case the first TypeSchema specification is always equal to the last TypeSchema specification.

Usage
-----

[](#usage)

To use this library you only need to create a `Reflector` instance which returns a `TypeSchema` model. This model can then be transformed into a JSON string using the Jackson `ObjectMapper`.

```
