PHPackages                             florianwolters/component-util-command - 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. florianwolters/component-util-command

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

florianwolters/component-util-command
=====================================

The Command behavioral design pattern as a PHP component.

06PHP

Since Sep 13Pushed 12y ago1 watchersCompare

[ Source](https://github.com/FlorianWolters/PHP-Component-Util-Command)[ Packagist](https://packagist.org/packages/florianwolters/component-util-command)[ RSS](/packages/florianwolters-component-util-command/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

FlorianWolters\\Component\\Util\\Command
========================================

[](#florianwolterscomponentutilcommand)

[![Build Status](https://camo.githubusercontent.com/384c99762a0891cc5e59c9bef92984e0f0ce239e65a9fe590b048dfbbc472ef3/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d5574696c2d436f6d6d616e642e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/FlorianWolters/PHP-Component-Util-Command)[![Latest Stable Version](https://camo.githubusercontent.com/a97902ede6e4869ea80d9bd0fd3a8883f90245bedda7c62722c37a307cbb054e/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d7574696c2d636f6d6d616e642f76657273696f6e2e706e67)](https://packagist.org/packages/florianwolters/component-util-command)[![Latest Unstable Version](https://camo.githubusercontent.com/c5021b894d6a0a076ad70c1dca65e2009dfb14f913fce09c5985579d0f847a10/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d7574696c2d636f6d6d616e642f762f756e737461626c652e706e67)](https://packagist.org/packages/florianwolters/component-util-command)

Period of TimeNumber of DownloadsTotal[![Total Downloads](https://camo.githubusercontent.com/b82be6a3a58998259b8a0bc1ee15f7dce2014fc09ac32bf29d2bd32308bc09ca/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d7574696c2d636f6d6d616e642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/florianwolters/component-util-command)Monthly[![Monthly Downloads](https://camo.githubusercontent.com/6f740b607ffb091874221b6635ae00da81a6cc00e688ae9759e3ce280e9872ef/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d7574696c2d636f6d6d616e642f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/florianwolters/component-util-command)Daily[![Daily Downloads](https://camo.githubusercontent.com/7d04d8ed0d12f4b59fd16cbce39c5ef60e7cef077168744e087b9efa5362a7fb/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d7574696c2d636f6d6d616e642f642f6461696c792e706e67)](https://packagist.org/packages/florianwolters/component-util-command)**FlorianWolters\\Component\\Util\\Command** is a simple-to-use [PHP](http://php.net "PHP: Hypertext Preprocessor") component that provides the *Command* behavioral design pattern.

Table of Contents (ToC)
-----------------------

[](#table-of-contents-toc)

- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Usage](#usage)
- [Installation](#installation)
    - [Local Installation](#local-installation)
    - [System-Wide Installation](#system-wide-installation)
- [As A Dependency On Your Component](#as-a-dependency-on-your-component)
    - [Composer](#composer)
    - [PEAR](#pear)
- [Development Environment](#development-environment)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

*Command* is a *behavioral* design pattern and defined as follows:

> "Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations."

\-- E. Gamma, et al. Design Patterns: Elements of Reusable Object-Oriented Software. Westford: Addison-Wesley, 1995.

Features
--------

[](#features)

- Follows the naming conventions for the *Command* design pattern
    - A command offers a member method `execute()`.
    - A sequence of commands can be executed with a `MacroCommand`, which implements the *Composite* structural design pattern.
- Artifacts tested with both static and dynamic test procedures:
    - Dynamic component tests (unit tests) implemented using [PHPUnit](http://phpunit.de "sebastianbergmann/phpunit · GitHub").
    - Static code analysis performed using the following tools:
        - [PHP\_CodeSniffer](http://pear.php.net/package/PHP_CodeSniffer "PHP_CodeSniffer"): Style Checker
        - [PHP Mess Detector (PHPMD)](http://phpmd.org "PHPMD - PHP Mess Detector"): Code Analyzer
        - [phpcpd](https://github.com/sebastianbergmann/phpcpd "sebastianbergmann/phpcpd · GitHub"): Copy/Paste Detector (CPD)
        - [phpdcd](https://github.com/sebastianbergmann/phpdcd "sebastianbergmann/phpdcd · GitHub"): Dead Code Detector (DCD)
- Installable via [Composer](http://getcomposer.org "Composer") or [PEAR installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php "Manual :: Command line installer (PEAR)"):
    - Provides a [Packagist](http://packagist.org "Packagist") package which can be installed using the dependency manager [Composer](http://getcomposer.org "Composer").
        - Click [here](http://packagist.org/packages/florianwolters/component-util-command "florianwolters/component-util-command - Packagist") for the package on [Packagist](http://packagist.org "Packagist").
    - Provides a [PEAR package](http://pear.php.net/manual/en/guide.users.concepts.package.php "Manual :: PEAR Packages") which can be installed using the package manager [PEAR installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php "Manual :: Command line installer (PEAR)").
        - Click [here](http://pear.florianwolters.de "PEAR channel of Florian Wolters") for the [PEAR channel](http://pear.php.net/manual/en/guide.users.concepts.channel.php "Manual :: PEAR Channels").
- Provides a complete Application Programming Interface (API) documentation generated with the documentation generator [phpDocumentor](http://phpdoc.org "phpDocumentor 2").
    - Click [here](http://blog.florianwolters.de/PHP-Component-Util-Command "FlorianWolters\Component\Util\Command | Application Programming Interface (API) documentation") for the current API documentation.
- Follows the [PSR-0](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md "PSR-0 requirements for autoloader interoperability") requirements for autoloader interoperability.
- Follows the [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md "PSR-1 basic coding style guide") basic coding style guide.
- Follows the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md "PSR-2 coding style guide") coding style guide.
- Follows the [PSR-5](https://github.com/phpDocumentor/fig-standards/blob/master/proposed/phpdoc.md "PSR-5 PHPDoc") PHPDoc standard.
- Follows the [Semantic Versioning](http://semver.org "Semantic Versioning") Specification (SemVer) 2.0.0-rc.1.

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

[](#requirements)

- [PHP](http://php.net "PHP: Hypertext Preprocessor") &gt;= 5.3

Usage
-----

[](#usage)

The best documentation for **FlorianWolters\\Component\\Util\\Command** are the unit tests, which are shipped in the package. You will find them installed into your [PEAR](http://pear.php.net "PEAR - PHP Extension and Application Repository") repository, which on Linux systems is normally `/usr/share/php/test`.

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

[](#installation)

### Local Installation

[](#local-installation)

**FlorianWolters\\Component\\Util\\Command** should be installed using the dependency manager [Composer](http://getcomposer.org "Composer"). [Composer](http://getcomposer.org "Composer") can be installed with [PHP](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md "PSR-0 requirements for autoloader interoperability").

```
php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));"

```

> This will just check a few [PHP](http://php.net "PHP: Hypertext Preprocessor") settings and then download `composer.phar` to your working directory. This file is the [Composer](http://getcomposer.org "Composer") binary. It is a PHAR ([PHP](http://php.net "PHP: Hypertext Preprocessor") archive), which is an archive format for [PHP](http://php.net "PHP: Hypertext Preprocessor") which can be run on the command line, amongst other things.
>
> Next, run the `install` command to resolve and download dependencies:

```
php composer.phar install

```

### System-Wide Installation

[](#system-wide-installation)

**FlorianWolters\\Component\\Util\\Command** should be installed using the [PEAR installer](http://pear.php.net/manual/en/guide.users.commandline.cli.php "Manual :: Command line installer (PEAR)"). This installer is the [PHP](http://php.net "PHP: Hypertext Preprocessor") community's de-facto standard for installing [PHP](http://php.net "PHP: Hypertext Preprocessor") components.

```
pear channel-discover pear.florianwolters.de
pear install --alldeps fw/Command

```

As A Dependency On Your Component
---------------------------------

[](#as-a-dependency-on-your-component)

### Composer

[](#composer)

If you are creating a component that relies on **FlorianWolters\\Component\\Util\\Command**, please make sure that you add **FlorianWolters\\Component\\Util\\Command** to your component's `composer.json` file:

```
{
    "require": {
        "florianwolters/component-util-command": "0.1.*"
    }
}
```

### PEAR

[](#pear)

If you are creating a component that relies on **FlorianWolters\\Component\\Util\\Command**, please make sure that you add **FlorianWolters\\Component\\Util\\Command** to your component's `package.xml` file:

```

      Command
      pear.florianwolters.de
      0.1.0
      0.1.99

```

Development Environment
-----------------------

[](#development-environment)

If you want to patch or enhance this component, you will need to create a suitable development environment. The easiest way to do that is to install [phix4componentdev](https://github.com/stuartherbert/phix4componentdev "stuartherbert/phix4componentdev · GitHub"):

```
# phix4componentdev
pear channel-discover pear.phix-project.org
pear install phix/phix4componentdev

```

You can then clone the Git repository:

```
# PHP-Component-Util-Command
git clone http://github.com/FlorianWolters/PHP-Component-Util-Command

```

Then, install a local copy of this component's dependencies to complete the development environment:

```
# build vendor/ folder
phing build-vendor

```

To make life easier for you, common tasks (such as running unit tests, generating code review analytics, and creating the [PEAR package](http://pear.php.net/manual/en/guide.users.concepts.package.php "Manual :: PEAR Packages")) have been automated using [phing](http://phing.info "Phing"). You'll find the automated steps inside the `build.xml` file that ships with the component.

Run the command `phing` in the component's top-level folder to see the full list of available automated tasks.

Contributing
------------

[](#contributing)

See [`CONTRIBUTING.md`](CONTRIBUTING.md).

Credits
-------

[](#credits)

- [Florian Wolters](https://github.com/FlorianWolters)
- [All Contributors](https://github.com/FlorianWolters/PHP-Component-Util-Command/contributors)

License
-------

[](#license)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/75dd7e42d69a87c4a0c68b4f29f5d223eb1f9a3f647abafa72da80d2a06d2442?d=identicon)[FlorianWolters](/maintainers/FlorianWolters)

---

Top Contributors

[![FlorianWolters](https://avatars.githubusercontent.com/u/1318837?v=4)](https://github.com/FlorianWolters "FlorianWolters (9 commits)")

### Embed Badge

![Health badge](/badges/florianwolters-component-util-command/health.svg)

```
[![Health](https://phpackages.com/badges/florianwolters-component-util-command/health.svg)](https://phpackages.com/packages/florianwolters-component-util-command)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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