{"id":24565965,"url":"https://github.com/steffenbrand/dmn-decision-tables","last_synced_at":"2025-04-22T10:36:28.521Z","repository":{"id":57059457,"uuid":"99481724","full_name":"steffenbrand/dmn-decision-tables","owner":"steffenbrand","description":"PHP library to programmatically create DMN decision tables.","archived":false,"fork":false,"pushed_at":"2019-03-18T14:03:31.000Z","size":46,"stargazers_count":19,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-22T10:36:13.764Z","etag":null,"topics":["bpmn","business-rules","camunda","decision-tables","dmn"],"latest_commit_sha":null,"homepage":"https://github.com/steffenbrand/dmn-decision-tables","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/steffenbrand.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-06T11:21:52.000Z","updated_at":"2024-11-28T09:59:05.000Z","dependencies_parsed_at":"2022-08-24T14:53:27.762Z","dependency_job_id":null,"html_url":"https://github.com/steffenbrand/dmn-decision-tables","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fdmn-decision-tables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fdmn-decision-tables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fdmn-decision-tables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steffenbrand%2Fdmn-decision-tables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steffenbrand","download_url":"https://codeload.github.com/steffenbrand/dmn-decision-tables/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250221670,"owners_count":21394745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bpmn","business-rules","camunda","decision-tables","dmn"],"created_at":"2025-01-23T12:17:41.798Z","updated_at":"2025-04-22T10:36:28.491Z","avatar_url":"https://github.com/steffenbrand.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://travis-ci.org/steffenbrand/dmn-decision-tables.svg?branch=master)](https://travis-ci.org/steffenbrand/dmn-decision-tables)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/steffenbrand/dmn-decision-tables/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/steffenbrand/dmn-decision-tables/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/steffenbrand/dmn-decision-tables/v/stable)](https://packagist.org/packages/steffenbrand/dmn-decision-tables)\n[![Total Downloads](https://poser.pugx.org/steffenbrand/dmn-decision-tables/downloads)](https://packagist.org/packages/steffenbrand/dmn-decision-tables)\n[![License](https://poser.pugx.org/steffenbrand/dmn-decision-tables/license)](https://packagist.org/packages/steffenbrand/dmn-decision-tables)\n\n# DMN Decision Tables\nPHP library to programmatically create DMN decision tables\n\n* [DMN Decision Tables on Packagist](https://packagist.org/packages/steffenbrand/dmn-decision-tables)\n* [DMN Decision Tables on GitHub](https://github.com/steffenbrand/dmn-decision-tables)\n\n## Limitations\n\n- Generated tables have been tested with [Camunda BPM platform](https://camunda.com/) and [Camunda Cloud](https://dmn.camunda.cloud/), but have __NOT__ been tested\nwith any other BPMN engine\n- Only [FEEL](https://docs.camunda.org/manual/latest/reference/dmn11/feel/) and JUEL expressions have been tested yet\n- Only one decision table is supported per .dmn-file\n- No DRD features are supported\n- IDs are generated randomly, as you can see from the examples below\n\n## How to install\n\n```\ncomposer require steffenbrand/dmn-decision-tables\n```\n\n## How to use\n\nThese examples show how to build the [Camunda Cloud](https://dmn.camunda.cloud/) example table\n\n### Build decision table\n\n```php\ntry {\n    $decisionTable = DecisionTableBuilder::getInstance()\n        -\u003esetName('Dish')\n        -\u003esetDefinitionKey('decision')\n        -\u003esetHitPolicy(HitPolicy::UNIQUE_POLICY)\n        -\u003eaddInput(new Input('Season', 'season', VariableType::STRING_TYPE))\n        -\u003eaddInput(new Input('How many guests', 'guests', VariableType::INTEGER_TYPE))\n        -\u003eaddOutput(new Output('Dish', 'dish', VariableType::STRING_TYPE))\n        -\u003eaddRule(\n            [\n                new InputEntry('\"Fall\"', ExpressionLanguage::FEEL_LANGUAGE),\n                new InputEntry('\u003c= 8', ExpressionLanguage::FEEL_LANGUAGE)\n            ],\n            [new OutputEntry('\"Spareribs\"', ExpressionLanguage::JUEL_LANGUAGE)]\n        )\n        -\u003eaddRule(\n            [new InputEntry('\"Winter\"'), new InputEntry('\u003c= 8')],\n            [new OutputEntry('\"Roastbeef\"')]\n        )\n        -\u003eaddRule(\n            [new InputEntry('\"Spring\"'), new InputEntry('\u003c= 4')],\n            [new OutputEntry('\"Dry Aged Gourmet Steak\"')]\n        )\n        -\u003eaddRule(\n            [new InputEntry('\"Spring\"'), new InputEntry('[5..8]')],\n            [new OutputEntry('\"Steak\"')],\n            'Save money'\n        )\n        -\u003eaddRule(\n            [new InputEntry('\"Fall\", \"Winter\", \"Spring\"'), new InputEntry('\u003e 8')],\n            [new OutputEntry('\"Stew\"')],\n            'Less effort'\n        )\n        -\u003eaddRule(\n            [new InputEntry('\"Summer\"'), new InputEntry(null)],\n            [new OutputEntry('\"Light Salad and a nice Steak\"')],\n            'Hey, why not!?'\n        )\n        -\u003ebuild();\n} catch (DmnValidationException $e) {\n    // Build method validates before it creates the DecisionTable.\n    // Can be disabled, so feel free to validate yourself.\n    // Use the DecisionTableValidator or inject your own validator.\n} catch (DmnConversionException $e) {\n    // Conversion to XML might fail because of invalid expressions or whatever.\n}\n```\n\n### Convert to DMN string (XML)\n\n```php\n$decisionTable-\u003etoDMN();\n\n```\n\n### Save to filesystem\n\n```php\n$decisionTable-\u003esaveFile('/my/path/and/filename.dmn');\n```\n\n### What the result looks like\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cdefinitions xmlns=\"http://www.omg.org/spec/DMN/20151101/dmn11.xsd\" id=\"definitions\" name=\"definitions\" namespace=\"http://camunda.org/schema/1.0/dmn\"\u003e\n  \u003cdecision id=\"decision\" name=\"Dish\"\u003e\n    \u003cdecisionTable id=\"decisionTable5990364503747\" hitPolicy=\"UNIQUE\"\u003e\n      \u003cinput id=\"input599036450376b\" label=\"Season\"\u003e\n        \u003cinputExpression id=\"inputExpression5990364503774\" typeRef=\"string\"\u003e\n          \u003ctext\u003eseason\u003c/text\u003e\n        \u003c/inputExpression\u003e\n      \u003c/input\u003e\n      \u003cinput id=\"input5990364503786\" label=\"How many guests\"\u003e\n        \u003cinputExpression id=\"inputExpression5990364503790\" typeRef=\"integer\"\u003e\n          \u003ctext\u003eguests\u003c/text\u003e\n        \u003c/inputExpression\u003e\n      \u003c/input\u003e\n      \u003coutput id=\"output59903645037c4\" label=\"Dish\" name=\"dish\" typeRef=\"string\"/\u003e\n      \u003crule id=\"rule59903645037de\"\u003e\n        \u003cinputEntry id=\"inputEntry59903645037fb\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Fall\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry5990364503816\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\u003c= 8]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry5990364503833\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Spareribs\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n      \u003crule id=\"rule5990364503847\"\u003e\n        \u003cinputEntry id=\"inputEntry5990364503880\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Winter\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry59903645038bf\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\u003c= 8]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry59903645038ee\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Roastbeef\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n      \u003crule id=\"rule59903645038fc\"\u003e\n        \u003cinputEntry id=\"inputEntry599036450390a\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Spring\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry5990364503916\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\u003c= 4]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry5990364503922\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Dry Aged Gourmet Steak\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n      \u003crule id=\"rule5990364503930\"\u003e\n        \u003cdescription\u003eSave money\u003c/description\u003e\n        \u003cinputEntry id=\"inputEntry599036450393e\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Spring\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry599036450394d\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[[5..8]]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry5990364503961\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Steak\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n      \u003crule id=\"rule599036450396e\"\u003e\n        \u003cdescription\u003eLess effort\u003c/description\u003e\n        \u003cinputEntry id=\"inputEntry599036450397b\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Fall\", \"Winter\", \"Spring\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry5990364503985\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\u003e 8]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry5990364503991\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Stew\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n      \u003crule id=\"rule599036450399d\"\u003e\n        \u003cdescription\u003eHey, why not!?\u003c/description\u003e\n        \u003cinputEntry id=\"inputEntry59903645039ab\" expressionLanguage=\"feel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Summer\"]]\u003e\u003c/text\u003e\n        \u003c/inputEntry\u003e\n        \u003cinputEntry id=\"inputEntry59903645039b4\"\u003e\n          \u003ctext/\u003e\n        \u003c/inputEntry\u003e\n        \u003coutputEntry id=\"outputEntry59903645039c0\" expressionLanguage=\"juel\"\u003e\n          \u003ctext\u003e\u003c![CDATA[\"Light Salad and a nice Steak\"]]\u003e\u003c/text\u003e\n        \u003c/outputEntry\u003e\n      \u003c/rule\u003e\n    \u003c/decisionTable\u003e\n  \u003c/decision\u003e\n\u003c/definitions\u003e\n\n```\n\n## Try it\n\nFeel free to download [generated_with_dmn_decision_tables.dmn](https://github.com/steffenbrand/dmn-decision-tables/blob/master/resources/generated_with_dmn_decision_tables.dmn)\nand try it in the [Camunda Cloud](https://dmn.camunda.cloud/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteffenbrand%2Fdmn-decision-tables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteffenbrand%2Fdmn-decision-tables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteffenbrand%2Fdmn-decision-tables/lists"}