briefley/filament-workflow-builder
Composer 安装命令:
composer require briefley/filament-workflow-builder
包简介
A Filament plugin for scheduled workflow orchestration with pluggable step executors.
README 文档
README
A generic Laravel workflow orchestration package with pluggable step executors and an optional Filament admin UI.
Features
- Interval and fixed-time daily workflow scheduling.
- Queue-driven workflow execution with pluggable step executors.
- Stale run protection and overlap control.
- Filament integration with a single Workflows navigation entry:
Stepsrelation manager for workflow step configuration.Runsrelation manager for history.- Run steps visible in a modal from each run row.
Compatibility Matrix
| Package line | Filament | Laravel | PHP | Status |
|---|---|---|---|---|
^1.0 |
^5.0 |
^11.0 | ^12.0 | ^13.0 |
^8.2 |
Primary line |
^0.4 |
^4.0 |
^11.28 | ^12.0 | ^13.0 |
^8.2 |
Legacy compatibility line |
^0.3 |
^3.3 |
^10.45 | ^11.0 | ^12.0 |
^8.1 | ^8.2 |
Legacy compatibility line |
Release Lines
^1.x(Filament v5) is the default and latest release line.^0.4.xis the Filament v4 maintenance line.^0.3.xis the Filament v3 maintenance line.
Latest Tags
1.0.3for Filament v5 projects.0.4.1for Filament v4 projects.0.3.1for Filament v3 projects.
Installation
- Require the package for your Filament major.
composer require briefley/filament-workflow-builder:^1.0 # Filament v5 composer require briefley/filament-workflow-builder:^0.4 # Filament v4 composer require briefley/filament-workflow-builder:^0.3 # Filament v3
- Publish config and migrations.
php artisan vendor:publish --tag=workflow-builder-config php artisan vendor:publish --tag=workflow-builder-migrations php artisan migrate
Maintenance Policy
^1.x(Filament v5) is the primary feature line.^0.4.x(Filament v4) and^0.3.x(Filament v3) are compatibility maintenance lines.- New features are developed on
^1.xfirst, then selectively backported when safe.
Configuration
Define available step types and executors in config/workflow-builder.php:
return [ 'workflow_jobs' => [ 'hello_world_job' => [ 'label' => 'Hello World Job', ], ], 'step_executors' => [ 'hello_world_job' => App\Workflow\Executors\HelloWorldStepExecutor::class, ], ];
Build Your Own Workflow Jobs
1. Create a step executor
Each workflow "job" is a step type mapped to an executor class.
<?php namespace App\Workflow\Executors; use Briefley\WorkflowBuilder\Contracts\WorkflowStepExecutor; use Briefley\WorkflowBuilder\DTO\StepExecutionResult; use Briefley\WorkflowBuilder\Models\WorkflowRunStep; use Illuminate\Support\Facades\Log; class SendReportStepExecutor implements WorkflowStepExecutor { public function execute(WorkflowRunStep $runStep): StepExecutionResult { // Run your business logic here (API call, file export, DB work, etc). Log::info('Report step executed', [ 'workflow_run_id' => $runStep->workflow_run_id, 'workflow_run_step_id' => $runStep->id, ]); return StepExecutionResult::succeeded(meta: [ 'report_id' => 123, ]); } }
1.1 Pass data from previous steps (optional)
If your job needs outputs from earlier jobs in the same workflow run, implement:
Briefley\WorkflowBuilder\Contracts\ContextAwareWorkflowStepExecutor
You will receive WorkflowStepExecutionContext containing succeeded previous step outputs (meta).
<?php use Briefley\WorkflowBuilder\Contracts\ContextAwareWorkflowStepExecutor; use Briefley\WorkflowBuilder\DTO\StepExecutionResult; use Briefley\WorkflowBuilder\DTO\WorkflowStepExecutionContext; use Briefley\WorkflowBuilder\Models\WorkflowRunStep; class SendEmailsFromCsvStepExecutor implements ContextAwareWorkflowStepExecutor { public function execute(WorkflowRunStep $runStep): StepExecutionResult { // Backward-compatible fallback when context is not available. return StepExecutionResult::failed('Missing context.'); } public function executeWithContext( WorkflowRunStep $runStep, WorkflowStepExecutionContext $context, ): StepExecutionResult { $csvPath = $context->latestValueForStepType('generate_fake_users_csv_job', 'csv_path'); if (! is_string($csvPath) || $csvPath === '') { return StepExecutionResult::failed('CSV path not found.'); } // Continue with your step logic... return StepExecutionResult::succeeded(); } }
Helpful context methods:
latestMetaForStepType(string $stepType): ?arraylatestValueForStepType(string $stepType, string $key, mixed $default = null): mixedmetaForSequence(int $sequence): ?arrayvalueForSequence(int $sequence, string $key, mixed $default = null): mixed
2. Return one of the supported step results
Each step executor must implement:
Briefley\WorkflowBuilder\Contracts\WorkflowStepExecutor
and return Briefley\WorkflowBuilder\DTO\StepExecutionResult from execute():
StepExecutionResult::succeeded(...)for completed steps.StepExecutionResult::failed('reason')to fail the run.StepExecutionResult::waiting(...)for async polling-style steps.
2.1 Production reliability tips
When implementing real jobs, these two patterns help avoid common production failures:
- Make retryable steps idempotent.
Persist processed item identifiers (for example email addresses, external IDs, or row hashes) in step
meta, and skip already-processed items on retry. - Avoid
dev-only runtime dependencies in executors. If your executor uses optional helpers/libraries (for example Faker), provide a fallback path so production installs with--no-devdo not crash.
3. Register your step type in config
Add your label and executor to config/workflow-builder.php:
return [ 'workflow_jobs' => [ 'send_report_job' => [ 'label' => 'Send Report Job', ], ], 'step_executors' => [ 'send_report_job' => App\Workflow\Executors\SendReportStepExecutor::class, ], ];
The step_executors key is the runtime source of truth.
The workflow_jobs key is used for friendly labels in UI selectors.
4. Add the step in Filament
- Open Workflows.
- Create or edit a workflow.
- In the Steps relation manager, add a row with your step type.
- Order steps by sequence.
5. Run scheduler + queue worker
The package dispatches due workflows from the scheduler, and steps execute in queue jobs.
php artisan schedule:work php artisan queue:work
If you use Horizon, run Horizon instead of queue:work.
Scheduler
Dispatch due workflows every minute from your scheduler:
Schedule::command('workflow-builder:dispatch-due')->everyMinute();
Filament Plugin
Register the plugin in your panel provider:
->plugin(\Briefley\WorkflowBuilder\WorkflowBuilderPlugin::make())
The plugin registers only the WorkflowResource and manages steps/runs via relation managers.
Testing
Run the package test suite:
composer test
briefley/filament-workflow-builder 适用场景与选型建议
briefley/filament-workflow-builder 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 10, 最近一次更新时间为 2026 年 04 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「workflow」 「laravel」 「scheduler」 「filament」 「filament-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 briefley/filament-workflow-builder 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 briefley/filament-workflow-builder 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 briefley/filament-workflow-builder 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
Symfony bundle to monitor and execute commands
Swoole server process management
Workflow logger
Reset scheduler tasks
A lightweight task queue on top of rybakit/phive-queue
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-22