PHPackages                             carloswph/phell - 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. carloswph/phell

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

carloswph/phell
===============

A wrapper for obtaining information and deal with common tasks on Linux servers in data formats.

v1.1.2(4y ago)08MITPHP

Since Apr 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/carloswph/phell)[ Packagist](https://packagist.org/packages/carloswph/phell)[ RSS](/packages/carloswph-phell/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Phell
=====

[](#phell)

Linux system monitor utilities offer a comprehensive way of checking and monitoring any server. However, not everyone wants or is able to be checking the command line all times. Also, as those commands use to return unformatted strings, it becomes challenging to process or store such data in a more friendly way.

This wrapper offers classes to execute and retrieve common shell system commands and return data in a PHP-friendly way. Available classes/commands:

- df
- man
- free
- lscpu
- lsmem
- vmstat (no arguments)

Installing
==========

[](#installing)

This package can be installed using Composer `composer require carloswph/phell`

Usage
=====

[](#usage)

Using Composer, you need to use the classes correspondent to the shell commands you want data to be gotten and parsed. Additionally, you may want to use the enum class Params(), which provides constants to modify and apply parameters to the shell commands you are working with.

```
use Phell\Df;
use Phell\Params;

require __DIR__ . '/vendor/autoload.php';

$df = new Df([
	Params::HUMAN_READABLE
]);
var_dump($df->get()); // Getting a parsed array of results for the shell command

/*
RESULTS:

array(10) {
  [0]=>
  array(6) {
    ["filesystem"]=>
    string(4) "udev"
    ["blocks/size"]=>
    string(4) "1.9G"
    ["used"]=>
    string(1) "0"
    ["available"]=>
    string(4) "1.9G"
    ["use_percentage"]=>
    string(2) "0%"
    ["mounted_on"]=>
    string(4) "/dev"
  }
  [1]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "382M"
    ["used"]=>
    string(4) "1.8M"
    ["available"]=>
    string(4) "380M"
    ["use_percentage"]=>
    string(2) "1%"
    ["mounted_on"]=>
    string(4) "/run"
  }
  [2]=>
  array(6) {
    ["filesystem"]=>
    string(9) "/dev/sda3"
    ["blocks/size"]=>
    string(4) "449G"
    ["used"]=>
    string(3) "31G"
    ["available"]=>
    string(4) "395G"
    ["use_percentage"]=>
    string(2) "8%"
    ["mounted_on"]=>
    string(1) "/"
  }
  [3]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "1.9G"
    ["used"]=>
    string(4) "156M"
    ["available"]=>
    string(4) "1.8G"
    ["use_percentage"]=>
    string(2) "9%"
    ["mounted_on"]=>
    string(8) "/dev/shm"
  }
  [4]=>
  array(6) {
    ["filesystem"]=>
    string(5) "tmpfs"
    ["blocks/size"]=>
    string(4) "5.0M"
    ["used"]=>
    string(4) "4.0K"
    ["available"]=>
    string(4) "5.0M"
    ["use_percentage"]=>
    string(2) "1%"
    ["mounted_on"]=>
    string(9) "/run/lock"
  }
  [5]=> ... and so on...
}

*/
```

Using 'man' command
===================

[](#using-man-command)

Using the command 'man' is somewhat different than using all the others. As per getting a response, one must provide the bash command for which the manual is required. So, while instantiating the class, you must pass the bash command as parameter.

```
use Phell\Man;
use Phell\Params;

require __DIR__ . '/vendor/autoload.php';

$cpu = new Man('dir');
echo $cpu->toHtml(); // Generate the response in readable HTML
var_dump($cpu->get()); // Regular response in JSON
var_dump($cpu->toArray()); // Parsed response in PHP array, in which subtitles of the manual are keys
```

Adding a new command
====================

[](#adding-a-new-command)

Of course you can use the main abstract class to manage any other shell command and add new classes. For such, the only mandatory method will be process(), using the protected visibility, and the sole necessary property being $command, in which you will declare your new shell command, like this:

```
namespace Phell;

/**
 *
 */
class NewCommand extends AbstractCommand
{
	protected $command = 'newcommand';

	protected function process($shell)
	{
		// Process and parsing
	}
}
```

Additionally, even though you can always find another way of processing additional parameters in your new command, we encourage you to use the enum class Params to do that - as some of the necessary parameters could be possibly around there yet.

Commands available
------------------

[](#commands-available)

This package in a work in progress, so new commands will be added eventually. Keep checking the README file and updating the package to get access to all of them.

**Available commands:** df, free, lscpu, lsmem, vmstat

**Underway:** iostat, uptime, groups

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90% 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 ~18 days

Total

4

Last Release

1800d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13c91dcf5209989038da335ba42538fa84670bf27400f220d182a76e0a720b74?d=identicon)[carloswph](/maintainers/carloswph)

---

Top Contributors

[![meuppt](https://avatars.githubusercontent.com/u/37983141?v=4)](https://github.com/meuppt "meuppt (9 commits)")[![carloswph](https://avatars.githubusercontent.com/u/78516217?v=4)](https://github.com/carloswph "carloswph (1 commits)")

---

Tags

command-lineshelllinuxshell-execshell commandssystem utilities

### Embed Badge

![Health badge](/badges/carloswph-phell/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[mrrio/shellwrap

Use any command-line tool as a PHP function.

738198.8k2](/packages/mrrio-shellwrap)[mikehaertl/php-shellcommand

An object oriented interface to shell commands

32437.5M61](/packages/mikehaertl-php-shellcommand)

PHPackages © 2026

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