PHPackages                             toolkit/sys-utils - 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. toolkit/sys-utils

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

toolkit/sys-utils
=================

some system tool library of the php

v2.0.6(1y ago)38.5k↓25%1MITPHPPHP &gt;8.1CI passing

Since Jan 30Pushed 1y ago1 watchersCompare

[ Source](https://github.com/php-toolkit/sys-utils)[ Packagist](https://packagist.org/packages/toolkit/sys-utils)[ Docs](https://github.com/php-toolkit/sys-utils)[ RSS](/packages/toolkit-sys-utils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (24)Used By (1)

System Utils
============

[](#system-utils)

[![License](https://camo.githubusercontent.com/e37de3d98565066f5e12a7d08667940d5e212d5a7e9297b621f337212f949969/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6f6c6b69742f7379732d7574696c732e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Php Version Support](https://camo.githubusercontent.com/a51b5b27adbad3a384d183e2ecf39cae5b45752f7678a5d485333ed717dbfe1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f6f6c6b69742f7379732d7574696c73)](https://packagist.org/packages/toolkit/sys-utils)[![Latest Stable Version](https://camo.githubusercontent.com/7eec1b775d99d56effe0f22f9732ae5eef09de455d3612f96d093bf3019a5f6f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6f6c6b69742f7379732d7574696c732e737667)](https://packagist.org/packages/toolkit/sys-utils)[![Unit-Tests](https://github.com/php-toolkit/sys-utils/actions/workflows/php.yml/badge.svg)](https://github.com/php-toolkit/sys-utils/actions)

Some useful system utils for php

- exec system command
- simple process usage
- php env info
- error and exception info

Install
-------

[](#install)

```
composer require toolkit/sys-utils
```

Usage
-----

[](#usage)

### ProcTasks

[](#proctasks)

**Example**:

```
use Toolkit\Sys\Proc\ProcTasks;

// ProcTasks::new() // will auto get cpu num as proc num
ProcTasks::new(['procNum' => 2])
    ->setTaskHandler(function (array $task, array $ctx) {
        $pid = $ctx['pid'];
        println("worker#{$ctx['id']} [PID:$pid] - handle task, task data", $task);
        sleep(random_int(1, 3));
    })
    ->onBeforeCreate(fn($pid, $num) => println("master [PID:$pid] - Will create task process, number:", $num))
    ->onWorkersCreated(fn($pid, $info) => println("master [PID:$pid] - All task process started,", 'Workers info', $info))
    ->onWorkerStart(fn($pid, $id) => println("worker#$id started, pid is", $pid))
    ->onWorkerExit(fn($pid, $id) => println("worker#$id exited, pid is", $pid))
    ->onCompleted(fn($pid) => println("master [PID:$pid] - all workers exited, tasks run completed"))
    ->setTasks([
        ['task1'], // one task
        ['task2'],
        ['task3'],
        ['task4'],
    ])
    ->addTask(['task5'])
    ->run();
```

**Run**:

```
php example/proc-tasks.php
```

**Output**:

```
master [PID:49731] - Will create task process, number: 2
master [PID:49731] - All task process started, Workers info {"49732":{"id":0,"pid":49732,"startAt":1639245860},"49733":{"id":1,"pid":49733,"startAt":1639245860}}
worker#0 started, pid is 49732
worker#0 [PID:49732] - handle task, task data ["task1"]
worker#1 started, pid is 49733
worker#1 [PID:49733] - handle task, task data ["task4"]
worker#1 [PID:49733] - handle task, task data ["task5"]
worker#0 [PID:49732] - handle task, task data ["task2"]
worker#1 exited, pid is 49733
worker#0 [PID:49732] - handle task, task data ["task3"]
worker#0 exited, pid is 49732
master [PID:49731] - all workers exited, tasks run completed

```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance47

Moderate activity, may be stable

Popularity25

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 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 ~119 days

Recently: every ~300 days

Total

23

Last Release

394d ago

Major Versions

v1.2.8 → v2.0.02021-12-02

PHP version history (4 changes)v1.0.0PHP &gt;=7.0.0

v1.0.5PHP &gt;7.1.0

v2.0.0PHP &gt;8.0.0

v2.0.6PHP &gt;8.1

### Community

Maintainers

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

---

Top Contributors

[![inhere](https://avatars.githubusercontent.com/u/5302062?v=4)](https://github.com/inhere "inhere (71 commits)")

---

Tags

processrun-commandssystem-envsystem-utilityphplibrarytoolsystem

### Embed Badge

![Health badge](/badges/toolkit-sys-utils/health.svg)

```
[![Health](https://phpackages.com/badges/toolkit-sys-utils/health.svg)](https://phpackages.com/packages/toolkit-sys-utils)
```

PHPackages © 2026

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