PHPackages                             nafisc/parameterparser - 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. nafisc/parameterparser

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

nafisc/parameterparser
======================

A library for parsing strings of parameters

v0.3.0(7y ago)831.1k↓52.6%[1 issues](https://github.com/nathan-fiscaletti/parameterparser/issues)1MITPHPPHP &gt;=7.0

Since Nov 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nathan-fiscaletti/parameterparser)[ Packagist](https://packagist.org/packages/nafisc/parameterparser)[ Docs](http://github.com/nathan-fiscaleti/parameterparser)[ RSS](/packages/nafisc-parameterparser/feed)WikiDiscussions master Synced 2d ago

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

Parameter Parser
================

[](#parameter-parser)

> **Parameter Parser** is a simple library used to parse intricate parameters from an array of strings.

> **Hint**: Parameter Parser is available through [Composer](https://getcomposer.org). `composer require nafisc/parameterparser`.

[![StyleCI](https://camo.githubusercontent.com/7bb5ab35ad810072b191562b85ce0b27bdded2ed06fe504942e3b79ee4d9a5ea/68747470733a2f2f7374796c6563692e696f2f7265706f732f37333032393031312f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/73029011)[![Latest Stable Version](https://camo.githubusercontent.com/ddb6106835b73ae11fbc5f853f869deaaa633af6b2b12f55031db98014a53d2f/68747470733a2f2f706f7365722e707567782e6f72672f6e61666973632f706172616d657465727061727365722f762f737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/nafisc/parameterparser)[![Total Downloads](https://camo.githubusercontent.com/2f84e9c8e6582e9c979d62ac9b2d2fe27b698b54d5e81c6331cbcbea563218f1/68747470733a2f2f706f7365722e707567782e6f72672f6e61666973632f706172616d657465727061727365722f646f776e6c6f6164733f666f726d61743d666c6174)](https://packagist.org/packages/nafisc/parameterparser)[![Latest Unstable Version](https://camo.githubusercontent.com/a2509a282003f8b5e60733e787d04f9d9246a6d386aaf417022d885fd5c7dfbf/68747470733a2f2f706f7365722e707567782e6f72672f6e61666973632f706172616d657465727061727365722f762f756e737461626c653f666f726d61743d666c6174)](https://packagist.org/packages/nafisc/parameterparser)[![License](https://camo.githubusercontent.com/439c52024ca8ae5a1175604e4eff435a4aeaaf4d81664c0c39a10deac25c6fd9/68747470733a2f2f706f7365722e707567782e6f72672f6e61666973632f706172616d657465727061727365722f6c6963656e73653f666f726d61743d666c6174)](https://packagist.org/packages/nafisc/parameterparser)

[Documentation](./docs/) - [Advanced Code Examples](./examples/Example1.md) - [Looking for the Python version?](https://github.com/nathan-fiscaletti/parameterparser-py)

### Features

[](#features)

- Parse command line parameters.
- Assign aliases to parameters.
- Custom closures for each command line parameter.
- Variadic closure support for arguments taking more than one value.
- Customize the way the command line is parsed.

### Example Usage

[](#example-usage)

```
// Initialize a new Cluster
$parameters = new Cluster();

// Add a Parameter to the Cluster
$parameter = parameter('-', 'name', function ($name) {
    return $name;
});

$parameter->setRequired(true)
          ->setDescription('Your name.');

$parameters->add($parameter);

// Create a new Parser using the Cluster
$parser = new Parser($argv, $parameters);

// Parse the parameters using the Parser.
$results = $parser->parse();

// Verify that the parameters were valid after parsing.
if (! $parser->isValid()) {

    // Since it was not valid, output usage.
    $parameters->printFullUsage(
        "Parameter Parser",
        "An advanced parameter parser for PHP",
        "v1.0.0"
    );

} else {

    // Retrieve the name from the results
    $name = $results['name'];

    // Output the name
    echo 'Your name is ' . $name . PHP_EOL;

}
```

### Output

[](#output)

```
~/ php test.php -name 'Nathan Fiscaletti'

   Your name is Nathan Fiscaletti

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Recently: every ~223 days

Total

23

Last Release

2562d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1699763?v=4)[Nathan Fiscaletti](/maintainers/nathan-fiscaletti)[@nathan-fiscaletti](https://github.com/nathan-fiscaletti)

---

Tags

clicommand-lineparametersphpphp-clicliparserparametercommandline

### Embed Badge

![Health badge](/badges/nafisc-parameterparser/health.svg)

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

###  Alternatives

[league/climate

PHP's best friend for the terminal. CLImate allows you to easily output colored text, special formats, and more.

1.9k14.7M301](/packages/league-climate)[nategood/commando

PHP CLI Commando Style

8123.4M40](/packages/nategood-commando)[phalcon/cli-options-parser

Command line arguments/options parser.

181.1M10](/packages/phalcon-cli-options-parser)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2959.5M255](/packages/helhum-typo3-console)[adhocore/cli

Command line interface library for PHP

3511.4M59](/packages/adhocore-cli)[aplus/cli

Aplus Framework CLI Library

2311.7M6](/packages/aplus-cli)

PHPackages © 2026

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