Installation
composer require alizharb/forgepulse
php artisan forgepulse:install
Runs migrations and publishes config/assets.
First Workflow
php artisan forgepulse:make-workflow OrderProcessing
Creates a scaffolded workflow with:
execute() methodAccess Designer
Visit /forgepulse/workflows in your browser. The drag-and-drop editor appears immediately.
SendEmail)workflow_nodes tableNode-Based Architecture
// Define custom action node
class SendEmailNode extends ActionNode
{
public function execute(Workflow $workflow, array $data)
{
Mail::to($data['email'])->send(new OrderEmail($data));
return ['status' => 'sent'];
}
}
BaseNode for custom logicexecute() for runtime behaviorConditional Branching
// In designer: Add "Condition" node
// Set rule: `{{ $data->amount > 1000 }}`
// Connect "Yes" and "No" paths
in, contains, date comparisons)Workflow Execution
$workflow = Workflow::find(1);
$result = $workflow->execute(['order_id' => 123, 'amount' => 500]);
WorkflowException on failuresAPI-Driven Triggers
Route::post('/orders/{id}/process', function ($id) {
$workflow = Workflow::where('slug', 'order-processing')->first();
return $workflow->execute(['order_id' => $id]);
});
Queue Background Jobs
$workflow->executeLater(['user_id' => 1], 'high');
// Uses Laravel Queues (supports `sync`, `database`, `redis`)
Event Listeners
// Trigger workflow on model event
OrderCreated::class => [
function ($order) {
Workflow::where('slug', 'post-order')->first()
->execute(['order' => $order]);
}
];
Real-Time Tracking
// Subscribe to workflow events
event(new WorkflowStarted($workflow));
// Listen via Pusher/Broadcast
Node Registration
registerNodes() is called in a service provider:
ForgePulse::registerNodes([
\App\Nodes\SendEmailNode::class,
]);
Data Serialization
serialize()/unserialize() or cast to arrays:
$data = ['user' => $user->toArray()];
Versioning Conflicts
workflow()->lockForUpdate() in custom logic.Livewire Caching
php artisan livewire:discover
Debugging Workflows
config/forgepulse.php:
'debug' => env('FORGEPULSE_DEBUG', false),
/forgepulse/logs.Performance Optimization
$workflow = Workflow::find(1)->load('nodes');
->withoutEvents() for bulk operations.Extending UI
resources/views/vendor/forgepulse/...resources/js/forgepulse.js.Testing Strategies
$node = Mockery::mock(SendEmailNode::class);
$node->shouldReceive('execute')->andReturn(['success' => true]);
WorkflowTestCase trait for integration tests.Conditional Logic Quirks
{{ $data->property }} (not $data['property']) in conditions.{{ $data->property->contains('value') }}.Rollback Safety
$workflow->rollbackToVersion(2);
Keyboard Shortcuts
Cmd+Z / Cmd+Shift+ZBackspaceCmd+Mouse WheelHow can I help you explore Laravel packages today?