PHPackages                             rtens/domin - 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. [Admin Panels](/categories/admin)
4. /
5. rtens/domin

ActiveLibrary[Admin Panels](/categories/admin)

rtens/domin
===========

General purpose DDD-friendly administration interface

v0.8.2(10y ago)61.1k2[4 issues](https://github.com/rtens/domin/issues)MITPHP

Since Feb 17Pushed 9y ago2 watchersCompare

[ Source](https://github.com/rtens/domin)[ Packagist](https://packagist.org/packages/rtens/domin)[ Docs](http://github.com/rtens/domin)[ RSS](/packages/rtens-domin/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Domin [![Build Status](https://camo.githubusercontent.com/53bd4e7e5aac7455249a9492451821e3feece10fac592e2e57000d4ccb2cbe8e/68747470733a2f2f7472617669732d63692e6f72672f7274656e732f646f6d696e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/rtens/domin) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/e018d52674a1a4b8338e64232d9f5ceca3b6944dd33839fcfb47a042dc678b53/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7274656e732f646f6d696e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rtens/domin/?branch=master)
=======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#domin--)

*domin* ( **do**main **m**odel **in**terface ) is an administration interface for abstract [Domain Models](https://en.wikipedia.org/wiki/Domain-driven_design#Concepts) using the [Command Object pattern](http://c2.com/cgi/wiki?CommandObject).

For an example of how to use use, check out the [sample application](https://github.com/rtens/domin-sample).

Model
-----

[](#model)

Every *ability* of a system is represented by an [`Action`](https://github.com/rtens/domin/blob/master/src/Action.php) which specifies how to execute it and what [`Parameters`](https://github.com/rtens/domin/blob/master/src/Parameter.php)it requires. Therefore *domin* can take care of getting missing parameters from the user using [`Fields`](https://github.com/rtens/domin/blob/master/src/delivery/Field.php). Actions may return values which are presented using [`Renderers`](https://github.com/rtens/domin/blob/master/src/delivery/Renderer.php).

Installation
------------

[](#installation)

To use *domin* in your project, require it with [Composer](http://getcomposer.org/download/)

```
composer require rtens/domin

```

If you would like to develop on *domin*, download it with [Composer](http://getcomposer.org/download/) and execute the specification with [scrut](https://github.com/rtens/scrut)

```
composer create-project -sdev rtens/domin
cd domin
vendor/bin/scrut spec

```

Quick Start
-----------

[](#quick-start)

To run *domin* as a web application with [curir](http://github.com/watoki/curir) as delivery system, paste the following code into `index.php`

```
use rtens\domin\delivery\web\adapters\curir\root\IndexResource;
use rtens\domin\delivery\web\WebApplication;
use watoki\curir\WebDelivery;

WebDelivery::quickResponse(IndexResource::class,
    WebDelivery::init(null,
        WebApplication::init(function (WebApplication $app) {
            // Set-up $app here (e.g. $app->actions->add('foo', ...))
        })));
```

To run *domin* with [silex](http://silex.sensiolabs.org/), past this code into `index.php`

```
use rtens\domin\delivery\web\adapters\silex\SilexControllerProvider;
use rtens\domin\delivery\web\WebApplication;
use Silex\Application;

require_once __DIR__ . '/vendor/autoload.php';

$app = new Application();
$app->mount('/', new SilexControllerProvider(
    WebApplication::init(function (WebApplication $app) {
        // Set-up $app here (e.g. $app->actions->add('foo', ...))
    })));
$app->run();
```

And then start a development server to access the application on [localhost:8000](http://localhost:8000)

```
$ php -S localhost:8000 index.php

```

To get the CLI application running, paste this code into `cli.php`

```
use rtens\domin\delivery\cli\CliApplication;

CliApplication::run(CliApplication::init(function (CliApplication $app) {
    // Set-up $app here (e.g. $app->actions->add('foo', ...))
}));
```

and run it with

```
$ php cli.php

```

Action!
-------

[](#action)

[`Actions`](https://github.com/rtens/domin/blob/master/src/Action.php) decide what [`Parameters`](https://github.com/rtens/domin/blob/master/src/Parameter.php) 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`](https://github.com/rtens/domin/blob/master/src/ActionRegistry.php), so all actions need to be added to it.

There are several ways to create actions:

#### Implementing `Action`

[](#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.

```
class MyAction implements Action {

    public function caption() {
        return 'Some Action';
    }

    public function description() {
        return 'Some Description';
    }

    public function parameters() {
        return [
            new Parameter('foo', new StringType()),
            new Parameter('bar', new ClassType(\DateTime::class))
        ];
    }

    public function fill(array $parameters) {
        $parameters['foo'] = 'default value of foo';
        return $parameters;
    }

    public function execute(array $parameters) {
        return "Make it so! " . json_encode($parameters);
    }
}

$actionRegistry->add('my', new MyAction());
```

#### Extending `ObjectAction`

[](#extending-objectaction)

If you represent abilities with [DTOs](https://en.wikipedia.org/wiki/Data_transfer_object), 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](http://tactician.thephpleague.com/).

```
class MyAction extends ObjectAction {

    public function __construct($class, TypeFactory $types, CommandBus $bus) {
        parent::__construct($class, $types);
        $this->bus = $bus;
    }

    protected function executeWith($object) {
        $this->bus->handle($object);
    }
}

$actionRegistry->add('my', new MyAction(MyCommand::class, $types, $bus));
$actionRegistry->add('your', new MyAction(YourCommand::class, $types, $bus));
$actionRegistry->add('their', new MyAction(TheirCommand::class, $types, $bus));
```

#### Generating `ObjectActions`

[](#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.

```
(new ObjectActionGenerator($actionRegistry, $typeFactory))->fromFolder('model/commands', function ($object) {
    $bus->handle($object);
});
```

#### Using `MethodAction`

[](#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.

```
$actionRegistry->add('my', new MethodAction($handler, 'handleMyCommand', $typeFactory));
$actionRegistry->add('your', new MethodAction($handler, 'handleYourCommand', $typeFactory));
$actionRegistry->add('their', new MethodAction($handler, 'handleTheirCommand', $typeFactory));
```

#### Generating `MethodActions`

[](#generating-methodactions)

There is also a `MethodActionGenerator` to register all methods of an object.

```
(new MethodActionGenerator($actionRegistry, $typeFactory))->fromObject($handler);
```

License
-------

[](#license)

*domin* is released under the [MIT License](https://opensource.org/licenses/MIT)

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

5

Last Release

3820d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e687108526c164e4ad1c49b8228514541bd90d43ef70665a087d00e34a1f7559?d=identicon)[rtens](/maintainers/rtens)

---

Top Contributors

[![rtens](https://avatars.githubusercontent.com/u/1468866?v=4)](https://github.com/rtens "rtens (313 commits)")

---

Tags

cmsadmindddadministrationdomain model

### Embed Badge

![Health badge](/badges/rtens-domin/health.svg)

```
[![Health](https://phpackages.com/badges/rtens-domin/health.svg)](https://phpackages.com/packages/rtens-domin)
```

###  Alternatives

[kunstmaan/admin-bundle

The Kunstmaan Admin bundle supplies your project with a basic, elegant backend interface you can modify and extend so you can make your perfect admin module. The clean interface makes it straightforward for you and the people working with it to change settings and modify content.

60152.3k36](/packages/kunstmaan-admin-bundle)[luyadev/luya-module-admin

Administration core module for all LUYA admin modules

48183.8k24](/packages/luyadev-luya-module-admin)[serverfireteam/blog

A nice blog system with laravel and laravelpanel

523.1k](/packages/serverfireteam-blog)

PHPackages © 2026

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