2017 © Pedro Peláez
 

library enum-generator

Generate sub class of enum from definition file.

image

genkiroid/enum-generator

Generate sub class of enum from definition file.

  • Friday, May 4, 2018
  • by genkiroid
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Enum Generator

build, (*1)

Generate PHP class definition that extends Enum class from file(yaml, json)., (*2)

Installation

composer require genkiroid/enum-generator

Usage

Generate to STDOUT., (*3)

enum-generator --in enums.yaml

Generate to files. (Specify output dir.), (*4)

enum-generator --in enums.yaml --out /tmp/enums/

Generate to files. (Overwrite.), (*5)

enum-generator --in enums.yaml --out /tmp/enums/ --force

Input file format

YAML

---
- User:
    state:
      active: 0
      inactive: 1
- Shop:
    state:
      active: 0
      inactive: 1

JSON

[
  {
    "User": {
      "state": {
        "active": 0,
        "inactive": 1
      }
    }
  },
  {
    "Shop": {
      "state": {
        "active": 0,
        "inactive": 1
      }
    }
  }
]

Output

STDOUT., (*6)

<?php

class UserState extends Enum
{
    const ACTIVE = 0;
    const INACTIVE = 1;
}
<?php

class ShopState extends Enum
{
    const ACTIVE = 0;
    const INACTIVE = 1;
}

Files., (*7)

UserState.php
ShopState.php

Tips

You can use genkiroid/enum_exporter to create input file from existing Ruby on Rails application., (*8)

License

MIT, (*9)

Author

genkiroid, (*10)

The Versions

04/05 2018

dev-master

9999999-dev

Generate sub class of enum from definition file.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar genkiroid

04/05 2018

0.2.1

0.2.1.0

Generate sub class of enum from definition file.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar genkiroid

28/04 2018

0.2.0

0.2.0.0

Generate sub class of enum from definition file.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar genkiroid

28/04 2018

0.1.0

0.1.0.0

Generate sub class of enum from definition file.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar genkiroid