2017 © Pedro Peláez
 

library valueobjects-transpiler

A code Generator for ValueObjects

image

eventsourced/valueobjects-transpiler

A code Generator for ValueObjects

  • Friday, July 29, 2016
  • by barryosull
  • Repository
  • 3 Watchers
  • 0 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ValueobjectTranspiler

A command line tool that generates PHP classes for ValueObjects, Entities, Commands and Events, based on a Yaml config file., (*1)

Config file

Here is a sample config file, (*2)

# ValueObjects
value\Integer: is intVal

value\Quantity: is intval and between 1, 20

value\Range:
  min: value\Integer
  max: value\Integer

# Collections
value\Products: contains entity\Product

# Entites
entity\User:
  id: value\Id
  name: value\Name

entity\Product:
  id: value\Id
  product_id: value\ProductId
  quantity: value\Quantity

# Commands
command\CreateUser:
  id: value\Id
  user: entity\User

# Events
event\ProductCreated:
  id: value\Id
  product: entity\Product
  quantity: value\Quantity

Location of config file

Put the config file in the folder that should contain the generated code., (*3)

Namespaces

The script will figure out namespaces based on the folder structure (it's PSR0 compliant). If you set the root as "/home/project/" and it finds a config file at "/home/project/cart/values/vos.yaml" Then it will set the namespace as ", (*4)

Generating

To generate code simple call the following in console., (*5)

php generate.php [path_of_your_project_root]

The system will scan for any vos.yaml files in that folder and any of its subfodlers., (*6)

The Versions

29/07 2016

dev-master

9999999-dev

A code Generator for ValueObjects

  Sources   Download

MIT

The Requires

 

The Development Requires

by Colin Lyons
by Kiran Guragai