dev-master
9999999-devA code Generator for ValueObjects
MIT
The Requires
- eventsourced/valueobjects dev-master
- league/flysystem-memory ^1.0
- league/plates ^3.1
- symfony/yaml ^3.1
The Development Requires
by Colin Lyons
by Kiran Guragai
Wallogit.com
2017 © Pedro Peláez
A code Generator for ValueObjects
A command line tool that generates PHP classes for ValueObjects, Entities, Commands and Events, based on a Yaml config file., (*1)
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
Put the config file in the folder that should contain the generated code., (*3)
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)
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)
A code Generator for ValueObjects
MIT