Skip to main content

DSL Reference

A condensed cheat sheet for the AUSUS DSL. For the explained version, see The PHP DSL.

Plugin skeleton

use Ausus\{DslPlugin, Dsl, Field, Action};

final class MyPlugin extends DslPlugin
{
public function name(): string { return 'myplugin'; }
public function phpNamespace(): string { return 'Acme\\MyPlugin'; }

public function dsl(Dsl $dsl): void { /* declare entities */ }
}

Dsl

CallReturns
$dsl->entity('local')EntityBuilder for {plugin}.local

EntityBuilder

CallPurpose
->fields(['name' => FieldBuilder, ...])declare domain fields
->actions(['name' => ActionBuilder, ...])declare actions
->workflow('fieldName')mark an enum field as workflow state
->projection('name', fields: [...], actions: [...], role: '...')declare a projection

Field

CallType
Field::string()string
Field::integer()integer
Field::datetime()datetime
Field::money()money
Field::enum('A', 'B', ...)enum

FieldBuilder modifiers

CallEffect
->nullable()allow null
->default($v)default value
->unique()unique-within-tenant (recorded, not enforced in v0.1.0)
->max($n)string max length (recorded, not enforced in v0.1.0)
->currency('USD')money currency
->options([...])enum options

Action

CallKindsubjectRequired
Action::create('f1', 'f2', ...)createfalse
Action::transition('field', from: 'A', to: 'B')transitiontrue

ActionBuilder modifiers

CallEffect
->requireRole('role')attach a RoleRequired policy
->stamp('field')(transition) write current timestamp to field
->andTransition('field', from: 'B', to: 'C')(transition) add a source→target pair

Field types

string · integer · enum · money · datetime — declarable. identity · version · system_string — system types, injected by the kernel.

System fields (auto-injected)

id (identity) · tenant_id (system_string) · _version (version) · created_at (datetime) · updated_at (datetime).

FQN naming

ThingPatternExample
Entity{plugin}.{entity}billing.invoice
Action{entity}.{action}billing.invoice.issue
Projection{entity}.{projection}billing.invoice.summary
Workflow{entity}.lifecyclebilling.invoice.lifecycle
SQL table{entity} with ._billing_invoice