Dynamic workflows for Laravel: leave requests, purchase approvals, applications, anything that goes through steps where people decide what happens next.
- Definitions with steps (start, task, decision, action, end), transitions, assignees and conditions, versioned: instances stay on the version they started with.
- Instances with tasks, an inbox per user, a full history and events.
- Fluent definitions for seeders, idempotent and lockable to code.
- A visual builder: drag, connect and edit steps, all by keyboard too, in Inertia React and Blade.
- Actions: notify (javaabu/notifications), update the record, call a webhook, set data, or your own.
- Step data with javaabu/form-builder forms.
- A tester that shows the path a run takes with sample data, and an optional laravel/ai assistant that designs workflows.
- Permissions through javaabu/permissions for any guard and user model. Optional javaabu/translatable. Dhivehi and RTL.
use Javaabu\Workflows\Definitions\Assignee;
use Javaabu\Workflows\Definitions\Step;
use Javaabu\Workflows\Definitions\Transition;
use Javaabu\Workflows\Facades\Workflows;
Workflows::define('leave-request')
->name(['en' => 'Leave request', 'dv' => 'ޗުއްޓީގެ އެދުން'])
->for(LeaveRequest::class)
->steps([
Step::start()->form('leave-request'),
Step::task('review')->assignTo(Assignee::subject('manager'))->runs('notify', ['to' => [['type' => 'assignees']], 'title' => 'A leave request to review']),
Step::end('approved')->runs('update_model', ['attributes' => ['status' => 'approved']]),
Step::end('rejected'),
])
->transitions([
Transition::make('submit')->from('start')->to('review'),
Transition::make('approve')->from('review')->to('approved')->label('Approve')->color('success'),
Transition::make('reject')->from('review')->to('rejected')->label('Reject')->color('danger')->requireComment()->skipForm(),
])
->sync();
// routes/web.php
Route::workflows(['guard' => 'web_admin', 'prefix' => 'admin/workflows', 'name' => 'admin.workflows']);
Route::workflowTasks(); // /tasks
// anywhere
$instance = $leave->startWorkflow('leave-request', by: $request->user(), data: $request);
$instance->transition('approve', by: $manager, comment: 'ރަނގަޅު');The docs are in docs/, indexed for assistants in llms.txt.
composer test
pnpm testSee CHANGELOG.
See CONTRIBUTING.
If you discover a security issue, email info@javaabu.com instead of using the issue tracker.
The MIT License (MIT). See License File for more information.