{"id":19198746,"url":"https://github.com/laravolt/camunda","last_synced_at":"2025-03-16T09:09:27.716Z","repository":{"id":36943543,"uuid":"232441814","full_name":"laravolt/camunda","owner":"laravolt","description":"Convenience Laravel HTTP client wrapper to interact with Camunda REST API.","archived":false,"fork":false,"pushed_at":"2024-09-11T07:55:31.000Z","size":102,"stargazers_count":17,"open_issues_count":6,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-03T02:09:36.962Z","etag":null,"topics":["camunda","laravel-package","php","rest-api","workflow"],"latest_commit_sha":null,"homepage":"https://laravolt.dev","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laravolt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-08T00:12:38.000Z","updated_at":"2025-01-26T19:06:58.000Z","dependencies_parsed_at":"2024-06-27T08:59:07.743Z","dependency_job_id":"fededd9a-9064-44b6-8f53-0d0dc1bd0f59","html_url":"https://github.com/laravolt/camunda","commit_stats":{"total_commits":76,"total_committers":4,"mean_commits":19.0,"dds":0.06578947368421051,"last_synced_commit":"13c9cc0000b4f4b292afc2c3583e9cecfcd9e9d4"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravolt%2Fcamunda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravolt%2Fcamunda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravolt%2Fcamunda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laravolt%2Fcamunda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laravolt","download_url":"https://codeload.github.com/laravolt/camunda/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847062,"owners_count":20357317,"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":["camunda","laravel-package","php","rest-api","workflow"],"created_at":"2024-11-09T12:23:37.569Z","updated_at":"2025-03-16T09:09:27.695Z","avatar_url":"https://github.com/laravolt.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# laravolt/camunda\nConvenience Laravel HTTP client wrapper to interact with Camunda REST API.\n\n## Installation\n`composer require laravolt/camunda`\n\n## Configuration\n\nPrepare your `.env`:\n\n```dotenv\nCAMUNDA_URL=http://localhost:8080/engine-rest\n\n#optional\nCAMUNDA_TENANT_ID=\nCAMUNDA_USER=\nCAMUNDA_PASSWORD=\n```\n\nAdd following entries to `config/services.php`:\n```php\n'camunda' =\u003e [\n    'url' =\u003e env('CAMUNDA_URL', 'https://localhost:8080/engine-rest'),\n    'user' =\u003e env('CAMUNDA_USER', 'demo'),\n    'password' =\u003e env('CAMUNDA_PASSWORD', 'demo'),\n    'tenant_id' =\u003e env('CAMUNDA_TENANT_ID', ''),\n],\n```\n\n\n## Usage\n\n### Process Definition\n```php\nuse Laravolt\\Camunda\\Http\\ProcessDefinitionClient;\n\n$variables = ['title' =\u003e ['value' =\u003e 'Sample Title', 'type' =\u003e 'string']];\n\n// Start new process instance\n$instance = ProcessDefinitionClient::start(key: 'process_1', variables: $variables);\n\n// Start new process instance with some business key\n$instance = ProcessDefinitionClient::start(key: 'process_1', variables: $variables, businessKey: 'somekey');\n\n\n// Get BPMN definition in XML format\nProcessDefinitionClient::xml(key: 'process_1');\nProcessDefinitionClient::xml(id: 'process_1:xxxx');\n\n// Get all definition\nProcessDefinitionClient::get();\n\n// Get definitions based on some parameters\n$params = ['latestVersion' =\u003e true];\nProcessDefinitionClient::get($params);\n```\n\nCamunda API reference: https://docs.camunda.org/manual/latest/reference/rest/process-definition/\n\n\n\n\n### Process Instance\n```php\nuse Laravolt\\Camunda\\Http\\ProcessInstanceClient;\n\n// Find by ID\n$processInstance = ProcessInstanceClient::find(id: 'some-id');\n\n// Get all instances\nProcessInstanceClient::get();\n\n// Get instances based on some parameters\n$params = ['businessKeyLike' =\u003e 'somekey'];\nProcessInstanceClient::get($params);\n\nProcessInstanceClient::variables(id: 'some-id');\nProcessInstanceClient::delete(id: 'some-id');\n```\n\nCamunda API reference: https://docs.camunda.org/manual/latest/reference/rest/process-instance/\n\n\n### Message Event\n\n```php\nuse Laravolt\\Camunda\\Http\\MessageEventClient;\n// Start processinstance with message event\n// Required\n// messageName : message event name\n// businessKey : Busniess key for process instance\n\n// Rerturn Process insntance from message event\n\nMessageEventClient::start(messageName: \"testing\",  businessKey: \"businessKey\")\n\n\n```\n\n\n\n### Task\n```php\nuse Laravolt\\Camunda\\Http\\TaskClient;\n\n$task = TaskClient::find(id: 'task-id');\n$tasks = TaskClient::getByProcessInstanceId(id: 'process-instance-id');\n$tasks = TaskClient::getByProcessInstanceIds(ids: 'arrayof-process-instance-ids');\nTaskClient::submit(id: 'task-id', variables: ['name' =\u003e ['value' =\u003e 'Foo', 'type' =\u003e 'String']]); // will return true or false\n$variables = TaskClient::submitAndReturnVariables(id: 'task-id', variables: ['name' =\u003e ['value' =\u003e 'Foo', 'type' =\u003e 'String']]) // will return array of variable\n\n// Claim a Task\n$tasks = TaskClient::claim($task_id,  $user_id);\n// Unclaim a Task\n$tasks = TaskClient::unclaim($task_id);\n// Assign a Task\n$tasks = TaskClient::assign($task_id,  $user_id);\n\n\n\n```\n\nCamunda API reference: https://docs.camunda.org/manual/latest/reference/rest/task/\n\n### External Task\n```php\nuse Laravolt\\Camunda\\Http\\ExternalTaskClient;\n\n$topics = [\n    ['topicName' =\u003e 'pdf', 'lockDuration' =\u003e 600_000]\n];\n$externalTasks = ExternalTaskClient::fetchAndLock('worker1', $topics);\nforeach ($externalTasks as $externalTask) {\n    // do something with $externalTask\n    // Mark as complete after finished\n    ExternalTaskClient::complete($externalTasks-\u003eid);\n}\n\n// Unlock some task\nExternalTaskClient::unlock($task-\u003eid)\n\n// Get task locked\n$externalTaskLocked = ExternalTaskClient::getTaskLocked();\n```\n\nCamunda API reference: https://docs.camunda.org/manual/latest/reference/rest/external-task/\n\n### Consume External Task\nCreate a new job to consume external task via `php artisan make:job \u003cJobName\u003e` and modify the skeleton:\n\n```php\nuse Laravolt\\Camunda\\Dto\\ExternalTask;\nuse Laravolt\\Camunda\\Http\\ExternalTaskClient;\n\npublic function __construct(\n    public string $workerId,\n    public ExternalTask $task\n) {\n}\n\npublic function handle()\n{\n    // Do something with $this-\u003etask, e.g: get the variables and generate PDF\n    $variables = \\Laravolt\\Camunda\\Http\\ProcessInstanceClient::variables($this-\u003etask-\u003eprocessDefinitionId);\n    // PdfService::generate()\n\n    // Complete the task\n    $status = ExternalTaskClient::complete($this-\u003etask-\u003eid, $this-\u003eworkerId);\n}\n\n```\n\nSubscribe to some topic:\n```php\n// AppServiceProvider.php\nuse Laravolt\\Camunda\\Http\\ExternalTaskClient;\n\npublic function boot()\n{\n    ExternalTaskClient::subscribe('pdf', GeneratePdf::class);\n}\n```\n\nRegister the scheduler:\n```php\n// app/Console/Kernel.php\nprotected function schedule(Schedule $schedule)\n{\n    $schedule-\u003ecommand('camunda:consume-external-task --workerId=worker1')-\u003eeveryMinute();\n}\n```\n\nIf you need shorter pooling time (sub-minute frequency), please check [Laravel Short Schedule](https://github.com/spatie/laravel-short-schedule).\n\nReference:\n- https://laravel.com/docs/master/scheduling\n- https://laravel.com/docs/master/queues\n- https://github.com/spatie/laravel-short-schedule\n\n### Task History (Completed Task)\n\n```php\nuse Laravolt\\Camunda\\Http\\TaskHistoryClient;\n\n$completedTask = TaskHistoryClient::find(id: 'task-id');\n$completedTasks = TaskHistoryClient::getByProcessInstanceId(id: 'process-instance-id');\n```\n\nCamunda API reference: https://docs.camunda.org/manual/latest/reference/rest/history/task/\n\n\n\n### Deployment\n\n```php\nuse Laravolt\\Camunda\\Http\\DeploymentClient;\n\n// Deploy bpmn file(s)\nDeploymentClient::create('test-deploy', '/path/to/file.bpmn');\nDeploymentClient::create('test-deploy', ['/path/to/file1.bpmn', '/path/to/file2.bpmn']);\n\n// Get deployment list\nDeploymentClient::get();\n\n// Find detailed info about some deployment\nDeploymentClient::find($id);\n\n// Truncate (delete all) deployments\n$cascade = true;\nDeploymentClient::truncate($cascade);\n\n// Delete single deployment\nDeploymentClient::delete(id: 'test-deploy', cascade: $cascade);\n\n```\n\n\n\n### Raw Endpoint\n\nYou can utilize `Laravolt\\Camunda\\CamundaClient` to call any Camunda REST endpoint.\n```php\nuse Laravolt\\Camunda\\CamundaClient;\n\n$response = CamundaClient::make()-\u003eget('version');\necho $response-\u003estatus(); // 200\necho $response-\u003eobject(); // sdtClass\necho $response-\u003ejson(); // array, something like [\"version\" =\u003e \"7.14.0\"]\n```\n\u003e `CamundaClient::make()` is a wrapper for [Laravel HTTP Client](https://laravel.com/docs/master/http-client) with base URL already set based on your Camunda services configuration. Take a look at the documentation for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaravolt%2Fcamunda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaravolt%2Fcamunda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaravolt%2Fcamunda/lists"}