PHPackages                             tourze/workerman-process-worker - 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. [CLI &amp; Console](/categories/cli)
4. /
5. tourze/workerman-process-worker

ActiveLibrary[CLI &amp; Console](/categories/cli)

tourze/workerman-process-worker
===============================

Workerman 进程管理器，支持外部进程的监控和事件处理

0.2.0(6mo ago)0339↓37.5%2MITPHPCI passing

Since Mar 29Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/tourze/workerman-process-worker)[ Packagist](https://packagist.org/packages/tourze/workerman-process-worker)[ RSS](/packages/tourze-workerman-process-worker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (6)Used By (2)

Workerman Process Worker
========================

[](#workerman-process-worker)

[English](README.md) | [中文](README.zh-CN.md)

[![Latest Version](https://camo.githubusercontent.com/85b0dc8e67b0cbc864468a81ecc43cbe2ce743382b5ef40f8d7e062961232211/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f776f726b65726d616e2d70726f636573732d776f726b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-process-worker)[![Build Status](https://camo.githubusercontent.com/3c75cbf80739d3f42836bab035102123295320544fd5b4157e0fec7fc34b2780/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f746f75727a652f7068702d6d6f6e6f7265706f2f63692e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/tourze/php-monorepo/actions)[![Quality Score](https://camo.githubusercontent.com/43930c8561a14d3f5a68c62b692ee20749bac4c043e09e88fd3fdd611660198f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/php-monorepo)[![Code Coverage](https://camo.githubusercontent.com/fce86ff4532b4694c22512e5e192a270f73dd27d6e5495fffb59c73cf14de807/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f7068702d6d6f6e6f7265706f2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/tourze/php-monorepo)[![Total Downloads](https://camo.githubusercontent.com/82920ab8055bfb0192ea030b580cc999e7f1235c8a1e8fedf71e725d10ac2ef5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f776f726b65726d616e2d70726f636573732d776f726b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tourze/workerman-process-worker)[![License](https://camo.githubusercontent.com/791b2c49d4d77262de6764e1f9b1463844fac1ebcfa6ae7882b049298b59b9a9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f746f75727a652f776f726b65726d616e2d70726f636573732d776f726b65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/tourze/workerman-process-worker/blob/master/LICENSE)

A Workerman extension that allows you to run and monitor external processes within the Workerman environment. This package provides seamless integration with external commands while maintaining the event-driven architecture of Workerman.

Inspired by

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
    - [Basic Usage](#basic-usage)
    - [Using Event Listeners (Recommended)](#using-event-listeners-recommended)
- [Detailed Usage](#detailed-usage)
    - [Constructor Parameters](#constructor-parameters)
    - [Event Types](#event-types)
    - [Event Handling Methods](#event-handling-methods)
    - [Custom Process Handler](#custom-process-handler)
    - [Worker Configuration](#worker-configuration)
    - [Advanced Example](#advanced-example)
- [API Reference](#api-reference)
    - [ProcessWorker Class](#processworker-class)
    - [Events](#events)
    - [ProcessHandlerInterface](#processhandlerinterface)
- [Use Cases](#use-cases)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- **Process Management**: Run any external command as a Workerman process
- **Real-time Monitoring**: Monitor process output in real-time with event-driven architecture
- **Event System**: Built-in Symfony EventDispatcher for flexible event handling
- **Lifecycle Management**: Handle process start, output, and exit events
- **Custom Handlers**: Support for custom process handlers via `ProcessHandlerInterface`
- **Seamless Integration**: Easy integration with existing Workerman applications
- **Reload Support**: Full support for Workerman's reload functionality
- **Dual Event API**: Both callback and event listener approaches supported

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Workerman 5.1 or higher
- Symfony EventDispatcher 7.3 or higher

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require tourze/workerman-process-worker
```

Quick Start
-----------

[](#quick-start)

### Basic Usage

[](#basic-usage)

```
