PHPackages                             busyphp/workflow - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. busyphp/workflow

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

busyphp/workflow
================

基于BusyPHP实现的工作流状态机，开发人员只需要简单配置即可实现复杂的状态流程转换

v1.0.3(2y ago)17Apache-2.0PHPPHP &gt;=8.0.0

Since May 22Pushed 2y ago1 watchersCompare

[ Source](https://github.com/busyphp/workflow)[ Packagist](https://packagist.org/packages/busyphp/workflow)[ Docs](http://www.harter.cn/?form=BusyPHP&plugin=busyphp/workflow)[ RSS](/packages/busyphp-workflow/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

BusyPHP状态机
==========

[](#busyphp状态机)

说明
--

[](#说明)

开发人员只需要简单配置即可实现复杂的状态流程转换

安装
--

[](#安装)

```
composer require busyphp/workflow

```

通过注解配置状态机
---------

[](#通过注解配置状态机)

```
namespace core\model\test;

#[\BusyPHP\workflow\annotation\StateMachine(
    // 状态字段名称
    field: 'status',

    // 模型支持的状态集合
    places: ['待审核', '待发布', '已发布', '已下架', '已取消'],

    // 状态转换过程配置
    transitions: [
        // 审核操作
        'examine' => [
            'from' => '待审核',
            'to' => '待发布'
        ],

        // 发布操作
        'publish' => [
            'from' => '待发布',
            'to' => '已发布'
        ],

        // 下架操作
        'revoke' => [
            'from' => '已发布',
            'to' => '已下架'
        ],

        // 取消操作
        'cancel' => [
            'form' => ['待审核', '待发布', '已发布', '已下架'],
            'to' => '已取消'
        ]
    ],

    // 初始状态
    initial: '待审核'
)]
class Test extends \BusyPHP\Model {
    // 绑定模型字段类即可自动为模型字段类添加虚拟属性
    // 指示是否可以进行对应的操作：
    // $field->canExamine bool
    // $field->canPublish bool
    // $field->canRevoke bool
    // $field->canCancel boll
    protected string $fieldClass = TestField::class;
}

class TestField extends \BusyPHP\model\Field {

}
```

通过命令行 `bp:ide-model` 生成状态机的相关方法
-------------------------------

[](#通过命令行-bpide-model-生成状态机的相关方法)

```
php think bp:ide-model core.model.test.Test
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~6 days

Total

4

Last Release

1071d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/de6a1fa6381f7af7435f453177ce4f8ddc72a4dcd4c9b9ac3530c9d1180b7c60?d=identicon)[busylife](/maintainers/busylife)

---

Top Contributors

[![brisk-php](https://avatars.githubusercontent.com/u/16153680?v=4)](https://github.com/brisk-php "brisk-php (5 commits)")

---

Tags

workflowstate-machine

### Embed Badge

![Health badge](/badges/busyphp-workflow/health.svg)

```
[![Health](https://phpackages.com/badges/busyphp-workflow/health.svg)](https://phpackages.com/packages/busyphp-workflow)
```

###  Alternatives

[zerodahero/laravel-workflow

Integerate Symfony Workflow component into Laravel.

204815.2k4](/packages/zerodahero-laravel-workflow)[ringierimu/state-workflow

Laravel State Workflow provide tools for defining and managing workflows and activities with ease.

3251.1k](/packages/ringierimu-state-workflow)[brexis/laravel-workflow

Integerate Symfony Workflow component into Laravel.

283125.6k](/packages/brexis-laravel-workflow)[pwm/s-flow

A lightweight library for defining state machines

742.5k](/packages/pwm-s-flow)[shrink0r/workflux

Finite state machine for php.

375.6k1](/packages/shrink0r-workflux)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

188.5k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
