Operations for Laravel
Architecture
Architecture
Three pieces:
Contracts\Operations— the single write surface (start,advanceStep,complete,fail,sweepStalled). Depend on this, never the concrete class.OperationManager— the default implementation, bound in the service provider. It is the one write path that keeps status honest to the state machine and dispatches events. Mutations run here, never through model events.Models\Operation— the persisted record.statusonly moves throughtransitionTo(), which refuses illegal moves.
Input value objects (DataObjects\*) carry intent so method signatures stay
stable as options grow. The manager resolves the Operation class through
config('operations.models.operation'), so a host can subclass it.