Download the PHP package rtens/domin without Composer
On this page you can find all versions of the php package rtens/domin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package domin
Short Description General purpose DDD-friendly administration interface
License MIT
Homepage http://github.com/rtens/domin
Informations about the package domin
Domin

domin ( domain model interface ) is an administration interface for abstract Domain Models using the Command Object pattern.
For an example of how to use use, check out the sample application.
Model
Every ability of a system is represented by an Action
which specifies how to execute it and what Parameters
it requires. Therefore domin can take care of getting missing parameters from the user using Fields
. Actions may
return values which are presented using Renderers
.
Installation
To use domin in your project, require it with Composer
composer require rtens/domin
If you would like to develop on domin, download it with Composer and execute the specification with scrut
composer create-project -sdev rtens/domin
cd domin
vendor/bin/scrut spec
Quick Start
To run domin as a web application with curir as delivery system, paste the following code into index.php
To run domin with silex, past this code into index.php
And then start a development server to access the application on localhost:8000
$ php -S localhost:8000 index.php
To get the CLI application running, paste this code into cli.php
and run it with
$ php cli.php
Action!
Actions
decide what Parameters
they need, how to fill()
them with default values and, most importantly, how to execute()
them.
The way domin knows what actions there are is through the ActionRegistry
, so all actions need to be added to it.
There are several ways to create actions:
Implementing Action
The most straight-forward although probably not most convenient way is to create an implementation of Action
for
every ability of the system.
Extending ObjectAction
If you represent abilities with DTOs, you can extend you actions from the ObjectAction
to infer Parameters
from
the properties of these classes using reflection. This sub-class can then be made generic for example by using
a Command Bus.
Generating ObjectActions
With a generic way to execute actions, you can use the ObjectActionGenerator
to generate and register actions from
all classes in a folder automatically.
Using MethodAction
If you don't feel like creating a class for every command, you can use the MethodAction
to infer parameters
from a method signature.
Generating MethodActions
There is also a MethodActionGenerator
to register all methods of an object.
License
domin is released under the MIT License