PHPackages                             ado-dg/integration-model-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. [API Development](/categories/api)
4. /
5. ado-dg/integration-model-generator

ActiveLibrary[API Development](/categories/api)

ado-dg/integration-model-generator
==================================

A package that allows you to generate PHP model classes from a JSON object and simplify API integrations using these models

06[1 issues](https://github.com/Ado-dg/integration-model-generator/issues)PHP

Since Jun 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Ado-dg/integration-model-generator)[ Packagist](https://packagist.org/packages/ado-dg/integration-model-generator)[ RSS](/packages/ado-dg-integration-model-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Integration model generator
===========================

[](#integration-model-generator)

Generates PHP model classes from JSON objects, to be used in API requests, using wol-soft's php generator().

Table of Contents
-----------------

[](#table-of-contents)

- [Motivation](#Motivation)
- [Installation](#Installation)
- [Basic usage](#Basic-usage)
- [Examples](#Examples)

Motivation
----------

[](#motivation)

This library was made as part of a bachelor's dissertation and was created with the goal of improving API integration's efficiency. This was achieved by giving the developers the possibility to generate PHP models for their API JSON bodies. This library is a work in progress project.

Installation
------------

[](#installation)

The recommended way to install integration-model-generator is through [Composer](http://getcomposer.org):

```
$ composer require ado-dg/integration-model-generator

```

Basic usage
-----------

[](#basic-usage)

The first step is preparing your JSON, every field that should be dynamic in the model needs its value between % characters:

```
{
  "name": "%name%"
}
```

Then, the generator needs to be initialized with following parameters:

- namespace: the target namespace of the to be generated model
- model path: the target directory of the to be generated model, will be made if doesn't exist and will be cleared if exists
- schema path: the target directory where the JSON schema's require by wol-soft's library will be stored, will be made if doesn't exist

Finally, the generation itself can happen by calling the "generateIntegrationModels" method of the generator object. This requires the following parameters:

- json: JSON body to be converted to model classes
- model name: the name of the to be generated model class (both filename and classname)

Examples
--------

[](#examples)

Following example is made for a JSON body required by Azure's TTS API.

JSON:

```
{
  "documents": [
    {
      "id": 1,
      "text": "%text%"
    }
  ]
}
```

PHP code for generating the model class to corresponding JSON:

```
use ado_dg\IntegrationModelGenerator\Generator;

// Autoload files using the Composer autoloader.
require_once __DIR__ . '/../../vendor/autoload.php';

$json = file_get_contents(__DIR__ . '/../../storage/azure.json');
$generator = new Generator('App\Models\IntegrationModels', __DIR__ . '/../Models/IntegrationModels', __DIR__ . '/../schema');
$generator->generateIntegrationModels($json, 'AzureJsonBody');
```

Now that the model class is generated it can be used as follows:

```
$body = new App\Models\IntegrationModels\TestJsonBody(["text" => "This is a test sentence"]);
$json =  $body->jsonSerialize();
```

The json variable could now be passed along to an HTTP client as JSON body

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0955070594afe9e29112f45fe8d0b21419ede4b1dd0f160fcaeb5f08e121f2d4?d=identicon)[Adrone](/maintainers/Adrone)

---

Top Contributors

[![Ado-dg](https://avatars.githubusercontent.com/u/56825128?v=4)](https://github.com/Ado-dg "Ado-dg (6 commits)")

### Embed Badge

![Health badge](/badges/ado-dg-integration-model-generator/health.svg)

```
[![Health](https://phpackages.com/badges/ado-dg-integration-model-generator/health.svg)](https://phpackages.com/packages/ado-dg-integration-model-generator)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
