Projectslaravel-actionsIntroduction

Laravel Actions

Package

Synchronously dispatched action classes for Laravel.

Upgrade Guide

Introduction

Laravel Actions gives you a dedicated place for application actions — compartmentalised units of work that are dispatched synchronously, faked in tests, and kept separate from your queued jobs.

Actions are shaped like Jobs (constructor + handle(), a dispatcher, a facade with fake() / assert*()), but they live on their own dispatcher so Bus::fake() does not swallow them and Action::fake() does not touch the Bus.

Design goals

  • Sync by design — actions run immediately in the current process
  • Bus-familiar testingAction::fake(), selective fakes, and assertions
  • Composable — per-action and global middleware pipelines
  • Observable — lifecycle events with duration timing
  • Replaceable — swap implementations via aliases or a custom dispatcher

What it is not

  • Not a queue / ShouldQueue system — use Laravel's Bus for that
  • Not a replacement for form requests, jobs, or listeners
  • Not opinionated about where business logic lives beyond “an Action class”

When to use it

Reach for this package when you want named, testable units of work (AssignDefaultRole, SendInvoice, ProvisionTenant) without putting them in App\Jobs or on Eloquent models.

Continue to Installation.