PHPackages                             craftpip/process-handler - 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. craftpip/process-handler

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

craftpip/process-handler
========================

Get list of running processes by name or pid, supports windows and unix

v2.0.0(3y ago)82745MITPHPPHP &gt;=8.1

Since Apr 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/craftpip/process-handler)[ Packagist](https://packagist.org/packages/craftpip/process-handler)[ Docs](https://github.com/craftpip/process-handler)[ RSS](/packages/craftpip-process-handler/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (2)Dependencies (2)Versions (6)Used By (0)

process-handler
===============

[](#process-handler)

[![Build Status](https://camo.githubusercontent.com/2a9a101f6802dca3379ba2a101e4c02d7f108696fe4f9f193afa9480f14fec35/68747470733a2f2f7472617669732d63692e6f72672f63726166747069702f70726f636573732d68616e646c65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/craftpip/process-handler)

Get list of running processes by name or pid, supports windows and unix

I struggled to find a library that returns the processes list for the operating system. My use case was to find if my spawned process was running or not.

Usage
-----

[](#usage)

```
// Include your autoload
require_once 'vendor/autoload.php';

use \Craftpip\ProcessHandler\ProcessHandler;
use \Symfony\Component\Process\Process;

// Initialize your library
$processHandler = new ProcessHandler();

// Spawn a process and check if a process by its pid exists.
$symfonyProcess = new Process('ls');
$symfonyProcess->start();
$pid = $symfonyProcess->getPid(); // 8378

$process = $processHandler->getProcess($pid);
if($process){
    $name = $process->getName();
    $pid = $process->getPid();
    $mem_used = $process->getMemUsed();
    $cpu_time = $process->getCpuTime();
    $session = $process->getSession();
    $session_name = $process->getSessionName();
    $status = $process->getStatus();
    $username = $process->getUsername();
    $window_title = $process->getWindowTitle();
    $is_running = $process->isRunning();

    /*
    Examples
    returns the following on UNIX
    [0] => Array
            (
                [name] => [sh]
                [pid] => 8378
                [session_name] =>
                [session] => 6065
                [mem_used] => 0 KB
                [status] => RUNNING
                [username] => root
                [cpu_time] => 00:00:00
                [window_title] =>
            )

    returns the following on WINDOWS
    [0] => Array
            (
                [name] => cmd.exe
                [pid] => 6380
                [session_name] => Console
                [session] => 1
                [mem_used] => 3,504 K
                [status] => Unknown
                [username] => BONIFACE-PC\boniface
                [cpu_time] => 0:00:00
                [window_title] => N/A
            )

    returns the following on macOS
    [0] => Array
            (
                [name] => (sh)
                [pid] => 62951
                [session_name] =>
                [session] => 0
                [mem_used] => 0 KB
                [status] => RUNNING
                [username] => username
                [cpu_time] => 0:00.00
                [window_title] =>
            )
    */
}else{
    // process was not found.
}

// get all processes
$allProcesses = $processHandler->getAllProcesses();
```

Methods
-------

[](#methods)

```
$processHandler = new ProcessHandler();
$processHandler->getAllProcesses();
$processHandler->getProcess($pid);
$processHandler->isRunning($pid);
```

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

[](#installation)

Run the composer command

```
composer require craftpip/process-handler
```

ProcessHandler can be installed with Composer by adding the library as a dependency to your composer.json file.

```
{
    "require": {
        "craftpip/process-handler": "~1.0"
    }
}
```

Contribute
----------

[](#contribute)

Please feel free to contribute or make additions.

Copyright and license
---------------------

[](#copyright-and-license)

Copyright (C) 2017 Boniface Pereira

Licensed under [the MIT license](LICENSE).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~550 days

Total

5

Last Release

1171d ago

Major Versions

v1.0.3 → v2.0.02023-04-17

PHP version history (2 changes)v1.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4782473?v=4)[Boniface Pereira](/maintainers/craftpip)[@craftpip](https://github.com/craftpip)

---

Top Contributors

[![craftpip](https://avatars.githubusercontent.com/u/4782473?v=4)](https://github.com/craftpip "craftpip (18 commits)")[![mozartk](https://avatars.githubusercontent.com/u/1418452?v=4)](https://github.com/mozartk "mozartk (9 commits)")

---

Tags

processpid existsprocess existsrunning processes

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/craftpip-process-handler/health.svg)

```
[![Health](https://phpackages.com/badges/craftpip-process-handler/health.svg)](https://phpackages.com/packages/craftpip-process-handler)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M24.7k](/packages/friendsofphp-php-cs-fixer)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k40](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k13](/packages/tempest-framework)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)

PHPackages © 2026

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