Skip to main content
Back to packages
1,215 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

Next.js Basics for Laravel Developers

11 lessons
58 min

Laravel 13 Starter Kit Teams and Customizations

10 lessons
33 min

Queues in Laravel 13

18 lessons
1 h 12 min read