Search by

alfasix / alfakit-workflows

faizanakbar10

State machines and approval workflows for any model of an AlfaKit panel: transitions with guards, forms and policies, single, any-of, all-of and multi-level approvals with delegation, reminders and escalation, an approvals inbox, a history timeline and a workflow diagram.

Package info

github.com/alfasixbh/alfakit-workflows

Homepage

Issues

pkg:composer/alfasix/alfakit-workflows

Statistics

Installs: 33

Dependents: 0

Suggesters: 0

Stars: 0

v0.2.5 2026-10-27 09:31 UTC

This package is auto-updated.

Last update: 2026-10-29 13:41:43 UTC


README

by Alfa Six

This is a read-only split of the AlfaKit monorepo. Please open issues and pull requests there.

State machines and approval workflows for any model of an AlfaKit panel: guarded, policy-checked transitions with forms and comments; single, any-of, all-of and multi-level approvals with due dates, reminders, delegation, reassignment and escalation; an approvals inbox with bulk approve; a history timeline; and an accessible workflow diagram drawn on the server. It renders in React, Vue and Svelte with AlfaKit's built-in components.

Installation

composer require alfasix/alfakit-workflows
php artisan vendor:publish --tag=alfakit-workflows-migrations
php artisan migrate

Register

use AlfaSix\AlfakitWorkflows\WorkflowsPlugin;

$panel->plugin(WorkflowsPlugin::make()->navigationGroup('Work'));

Define a workflow

use AlfaSix\AlfakitWorkflows\ApprovalStep;
use AlfaSix\AlfakitWorkflows\Concerns\HasWorkflow;
use AlfaSix\AlfakitWorkflows\State;
use AlfaSix\AlfakitWorkflows\Transition;
use AlfaSix\AlfakitWorkflows\Workflow;

class Invoice extends Model
{
    use HasWorkflow;

    public static function workflow(): Workflow
    {
        return Workflow::make('invoice')
            ->states([
                State::make('draft')->color('gray'),
                State::make('submitted')->color('warning'),
                State::make('approved')->color('success'),
                State::make('rejected')->color('danger'),
                State::make('paid')->color('primary')->final(),
            ])
            ->transitions([
                Transition::make('submit')->from('draft')->to('approved')
                    ->requiresApproval([ApprovalStep::make('manager')->role('manager')->dueIn('2 days')])
                    ->pendingState('submitted')
                    ->rejectedState('rejected'),
                Transition::make('pay')->from('approved')->to('paid')->requiresComment(),
            ])
            ->initial('draft');
    }
}

Use it

// Resource view page
protected function getHeaderActions(): array
{
    return [WorkflowActions::make()->dropdown(false)];
}

// Infolist
WorkflowStateEntry::make(),
WorkflowDiagram::make(),
WorkflowTimeline::make(),

// Table
WorkflowStateColumn::make(),
WorkflowStateFilter::make(),
->recordActions([WorkflowActions::make()])

Schedule reminders and escalation:

Schedule::command('alfakit-workflows:process')->everyFifteenMinutes();

Read the full documentation at alfakit.dev/docs/plugins/workflows.

License

MIT. See LICENSE.md.