{"id":13793140,"url":"https://github.com/ProcessMaker/nayra","last_synced_at":"2025-05-12T17:31:50.388Z","repository":{"id":41490370,"uuid":"126052447","full_name":"ProcessMaker/nayra","owner":"ProcessMaker","description":"Nayra is a BPMN workflow engine in PHP. Utilize it in your own projects to have your own complex workflow capabilities.","archived":false,"fork":false,"pushed_at":"2023-11-13T16:34:45.000Z","size":1496,"stargazers_count":111,"open_issues_count":19,"forks_count":31,"subscribers_count":35,"default_branch":"develop","last_synced_at":"2024-05-04T01:42:12.103Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ProcessMaker.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-03-20T16:57:17.000Z","updated_at":"2024-04-09T17:07:49.000Z","dependencies_parsed_at":"2023-09-26T04:51:12.826Z","dependency_job_id":"88e854f7-92b9-4c4c-b9db-eb2ad87a614a","html_url":"https://github.com/ProcessMaker/nayra","commit_stats":{"total_commits":448,"total_committers":13,"mean_commits":34.46153846153846,"dds":0.3214285714285714,"last_synced_commit":"e83d67072632fd178018905eba311e7a85e70622"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProcessMaker%2Fnayra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProcessMaker%2Fnayra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProcessMaker%2Fnayra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ProcessMaker%2Fnayra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ProcessMaker","download_url":"https://codeload.github.com/ProcessMaker/nayra/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225144934,"owners_count":17427894,"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":[],"created_at":"2024-08-03T22:01:22.846Z","updated_at":"2024-11-18T07:30:18.460Z","avatar_url":"https://github.com/ProcessMaker.png","language":"PHP","funding_links":[],"categories":["类库"],"sub_categories":["工作流"],"readme":"# ProcessMaker Nayra\n\nProcessMaker Nayra is a package that provides base classes to implement a process execution engine.\nThis includes patterns to implement activities, events and gateways.\n\n## How to execute a process\n\nLoad a BPMN definition\n```\n        $bpmnRepository = new BpmnDocument();\n        $bpmnRepository-\u003esetEngine($this-\u003eengine);\n        $bpmnRepository-\u003esetFactory($this-\u003erepository);\n        $bpmnRepository-\u003eload('files/ParallelGateway.bpmn');\n```\n![ParallelGateway diagram](/docs/diagrams/ParallelGateway.svg \"ParallelGateway diagram\")\n\nGet a reference to the process\n```\n        $process = $bpmnRepository-\u003egetProcess('ParallelGateway');\n```\nCreate a data storage\n```\n        $dataStore = $this-\u003erepository-\u003ecreateDataStore();\n```\nCreate a process instance\n```\n        $instance = $this-\u003eengine-\u003ecreateExecutionInstance($process, $dataStore);\n```\nTrigger the start event\n```\n        $start = $bpmnRepository-\u003egetStartEvent('StartEvent');\n        $start-\u003estart($instance);\n```\n![Start Event](/docs/diagrams/ParallelGateway_1.svg \"Start Event\")\n\nExecute tokens and run to the next state\n```\n        $this-\u003eengine-\u003erunToNextState();\n```\nOne token arrives to the first task\n```\n        $firstTask = $bpmnRepository-\u003egetScriptTask('start');\n        $token = $firstTask-\u003egetTokens($instance)-\u003eitem(0);\n```\n![First task](/docs/diagrams/ParallelGateway_2.svg \"First task\")\n\nComplete the first task\n```\n        $startActivity-\u003ecomplete($token);\n```\nExecute tokens and run to the next state\n```\n        $this-\u003eengine-\u003erunToNextState();\n```\nOne token arrives to the second task and one to the third task\n```\n        $secondTask = $bpmnRepository-\u003egetScriptTask('ScriptTask_1');\n        $token1 = $secondTask-\u003egetTokens($instance)-\u003eitem(0);\n        $thirdTask = $bpmnRepository-\u003egetScriptTask('ScriptTask_2');\n        $token2 = $thirdTask-\u003egetTokens($instance)-\u003eitem(0);\n```\n![Second task and third task](/docs/diagrams/ParallelGateway_3.svg \"Second task and third task\")\n\n\n## License\n\nProcessMaker Nayra is open-sourced software licensed under the [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProcessMaker%2Fnayra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FProcessMaker%2Fnayra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FProcessMaker%2Fnayra/lists"}