Skip to main content
Back to packages
1,207 GitHub stars

laravel-workflow/laravel-workflow

View on GitHub

Description

A package for the Laravel web framework that provides tools for defining and managing workflows and activities.

1. Create a workflow

use function Workflow\activity;
use Workflow\Workflow;
 
class MyWorkflow extends Workflow
{
public function execute($name)
{
$result = yield activity(MyActivity::class, $name);
 
return $result;
}
}

2. Create an activity

use Workflow\Activity;
 
class MyActivity extends Activity
{
public function execute($name)
{
return "Hello, {$name}!";
}
}

3. Run the workflow

use Workflow\WorkflowStub;
 
$workflow = WorkflowStub::make(MyWorkflow::class);
$workflow->start('world');
$workflow->output();
=> 'Hello, world!'

Recent Courses on Laravel Daily