PHPackages                             api-clients/resource-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. api-clients/resource-generator

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

api-clients/resource-generator
==============================

Resource from YAML generation tool

1.0.2(8y ago)233.1k↓50%1[5 PRs](https://github.com/php-api-clients/resource-generator/pulls)4MITPHPPHP ^7.0

Since Jun 2Pushed 2y ago3 watchersCompare

[ Source](https://github.com/php-api-clients/resource-generator)[ Packagist](https://packagist.org/packages/api-clients/resource-generator)[ RSS](/packages/api-clients-resource-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (9)Versions (16)Used By (4)

API Client Foundation for PHP 7
===============================

[](#api-client-foundation-for-php-7)

[![Linux Build Status](https://camo.githubusercontent.com/0589b6860c87bd6c23ca9b0417f4f25e90ff568633d323caddf0583d5a963b0c/68747470733a2f2f7472617669732d63692e6f72672f7068702d6170692d636c69656e74732f7265736f757263652d67656e657261746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/php-api-clients/resource-generator)[![Windows Build status](https://camo.githubusercontent.com/8878eb0d45a02b9b77075221767562b6a9ae2d8646ff970363136595466f6c83/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f64766375396c38726d367368793774333f7376673d74727565)](https://ci.appveyor.com/project/php-api-clients/resource-generator)[![Latest Stable Version](https://camo.githubusercontent.com/24a769db40ff7e643de97331853adc406568183f558c895b26c9fe0c9a6a0575/68747470733a2f2f706f7365722e707567782e6f72672f6170692d636c69656e74732f7265736f757263652d67656e657261746f722f762f737461626c652e706e67)](https://packagist.org/packages/api-clients/resource-generator)[![Total Downloads](https://camo.githubusercontent.com/002e42a59cd1e4c3e6a23ab7ea317e668eaf69b4301bf0ef284755c67a10a908/68747470733a2f2f706f7365722e707567782e6f72672f6170692d636c69656e74732f7265736f757263652d67656e657261746f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/api-clients/resource-generator)[![Code Coverage](https://camo.githubusercontent.com/ffc450dec00c9dbfdbdeba730de6b23a4eb39acfbb0e399ea58cb1d084d0c8a4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7068702d6170692d636c69656e74732f7265736f757263652d67656e657261746f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/php-api-clients/resource-generator/?branch=master)[![License](https://camo.githubusercontent.com/cb183e1bac2350096567b33d05a0c70acaf7a005ab6969d9dccd8d99b68ba9a7/68747470733a2f2f706f7365722e707567782e6f72672f6170692d636c69656e74732f7265736f757263652d67656e657261746f722f6c6963656e73652e706e67)](https://packagist.org/packages/api-clients/resource-generator)[![PHP 7 ready](https://camo.githubusercontent.com/b9424729c314caa8fd87771046394fd36c40a88615d75de4e3c080baf3fb9874/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f7068702d6170692d636c69656e74732f7265736f757263652d67656e657261746f722f62616467652e737667)](https://appveyor-ci.org/php-api-clients/resource-generator)

Goals
=====

[](#goals)

- Tool for easy wireframing of resources for `wyrihaximus/api-client` based API clients

Installation
============

[](#installation)

To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `^`.

```
composer require api-clients/resource-generator

```

Usage
=====

[](#usage)

Pas a `definition` [`YAML`](#YAML) file.

```
./vendor/bin/api-client-resource-generator [definition]

```

For example:

```
./vendor/bin/api-client-resource-generator ./yaml/project.yml

```

YAML
====

[](#yaml)

The [`YAML`](https://en.wikipedia.org/wiki/YAML) format allows for quick and easy generation of resources, empty resources, and resource tests. The spec consists out of two or more files.

`resource.yaml`
---------------

[](#resourceyaml)

First there is the `resource.yml` file with the meta data regarding all resources:

```
yaml_location: yaml                        # The location where the YAML files for the Resources are
api_settings: Example\Client\ApiSettings   # API Settings file location
src:                                       # SRC
  path: src/Resources                      # Path where the resources should be placed
  namespace: Example\Client\Resource       # The namespace for the resources
tests:                                     # TESTS
  path: tests/Resources                    # Path where the resources tests should be placed
  namespace: Example\Tests\Client\Resource # The namespace for the tests
```

`yaml/project.yaml`
-------------------

[](#yamlprojectyaml)

The following `YAML` is an example resource file:

```
class: Project                             # Resource classname
properties:                                # The resource's properties
  id: int                                  # Simple id field with type int
  name: string                             # Any scalar types or classes work
  plugins: SplObjectStorage                #
  builds:                                  # But differet types `special` properties are supported.
    type: array                            # For example the collection expects the type to be an array
    annotations:                           # and it uses an annotation name `collection` to
      collection: Project\Build            # transform all items in the array to the specified resource.
  latestBuild:                             # Another supported annotation is `nested`, `nested` allows you to
    type: Project\Build                    # turn a properties that would otherwise be an array into a
    annotations:                           # resource. With it's own properties and methods
      nested: Project\Build                #
  updated:                                 # Normally all methods are generated to their camelCase property name
    method: updatedAt                      # but with `method` you can specify a custom method
    type: DateTimeInterface                # When for example dealing with time, you can specify to return an interface
    wrap: DateTimeImmutable                # while wrapping the value in a concrete class
```

License
=======

[](#license)

The MIT License (MIT)

Copyright (c) 2016 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.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 77.4% 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.

###  Release Activity

Cadence

Every ~198 days

Total

4

Last Release

3041d ago

Major Versions

0.9.0 → 1.0.02017-08-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/147145?v=4)[Cees-Jan Kiewiet](/maintainers/WyriHaximus)[@WyriHaximus](https://github.com/WyriHaximus)

---

Top Contributors

[![WyriHaximus](https://avatars.githubusercontent.com/u/147145?v=4)](https://github.com/WyriHaximus "WyriHaximus (285 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (36 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (20 commits)")[![jcomack](https://avatars.githubusercontent.com/u/4181340?v=4)](https://github.com/jcomack "jcomack (2 commits)")[![mdrost](https://avatars.githubusercontent.com/u/4083346?v=4)](https://github.com/mdrost "mdrost (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")

---

Tags

hacktoberfestphpreactphp

### Embed Badge

![Health badge](/badges/api-clients-resource-generator/health.svg)

```
[![Health](https://phpackages.com/badges/api-clients-resource-generator/health.svg)](https://phpackages.com/packages/api-clients-resource-generator)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[tempest/framework

The PHP framework that gets out of your way.

2.1k23.1k9](/packages/tempest-framework)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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