cboxdk/laravel-operations
Composer 安装命令:
composer require cboxdk/laravel-operations
包简介
Durable, multi-step operations for Laravel — a strict state machine with per-step progress, idempotent retries, and a stall sweep.
README 文档
README
Durable, multi-step operations for Laravel — the operations engine behind long-running background work. Track a deploy, a provisioning run, or an import as a first-class record with a strict state machine, per-step progress, idempotent retries, and a stall sweep — instead of a black-box job.
use Cbox\Operations\Contracts\Operations; use Cbox\Operations\DataObjects\{StartOperation, AdvanceStep, CompleteOperation}; $operations = app(Operations::class); $op = $operations->start(new StartOperation( kind: 'deploy', targetType: 'workload', targetId: 'wl_123', steps: ['build', 'release', 'route'], expiresAt: now()->addMinutes(15), // stalls after this → swept to failed )); $operations->advanceStep(new AdvanceStep($op->id, 'build')); // build done, release starts $operations->advanceStep(new AdvanceStep($op->id, 'release')); $operations->advanceStep(new AdvanceStep($op->id, 'route')); $operations->complete(new CompleteOperation($op->id));
Every change dispatches an OperationUpdated event, so a client can watch
progress live without polling. Re-running a step or a completion is a safe no-op
(at-least-once workers never double-apply).
Why
Background work that spans several steps usually collapses to a single job with
no visible progress and no way to tell "stuck" from "slow". Cbox Operations gives
that work an auditable status (pending → running → completed | failed),
per-step timing, and a deadline so a crashed worker self-heals into a terminal
failed rather than a stuck running forever.
Install
composer require cboxdk/laravel-operations php artisan migrate
Schedule the stall sweep so past-deadline operations self-heal:
Schedule::command('operations:sweep-stalled')->everyMinute();
Design
-
Contracts-first. Depend on
Cbox\Operations\Contracts\Operations, never the concrete manager — so you can decorate it and tests can swap the bundled fake. -
Deny-by-default state machine. Illegal transitions throw; terminal states never move.
-
Tenancy-agnostic.
tenant_idis an optional column the package simply persists — bring your own scoping. -
Broadcast-agnostic.
OperationUpdatedis a plain event; wire it to your own transport if you want live UI. -
Dogfooded testing. Ship
InteractsWithOperations+FakeOperationsand use them in your own suite:$ops = $this->fakeOperations(); $this->deploy('wl_123'); $ops->assertStarted('deploy');
Documentation
Full docs live in /docs: quickstart, architecture, the state
machine, cookbook recipes, extension points, and the security/scope notes.
License
MIT © Cbox
cboxdk/laravel-operations 适用场景与选型建议
cboxdk/laravel-operations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「workflow」 「laravel」 「state-machine」 「operations」 「saga」 「process-manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cboxdk/laravel-operations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cboxdk/laravel-operations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cboxdk/laravel-operations 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Workflow for NetCommons Plugin
Workflow logger
Control your state using enums
Approval Workflow Engine for Filament
A workflow manager plugin for FilamentPHP with PHP enum support.
Operational approvals engine for Laravel applications.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-15