PHPackages                             malenki/argile - 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. malenki/argile

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

malenki/argile
==============

CLI app now easy when using args!

3.0(12y ago)26.6k[4 issues](https://github.com/malenkiki/argile/issues)5MITPHPPHP &gt;=5.3.0

Since Aug 18Pushed 12y ago1 watchersCompare

[ Source](https://github.com/malenkiki/argile)[ Packagist](https://packagist.org/packages/malenki/argile)[ Docs](https://github.com/malenkiki/argile)[ RSS](/packages/malenki-argile/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (13)Used By (5)

Argile
======

[](#argile)

[![Latest Stable Version](https://camo.githubusercontent.com/70828774ba983adfe65f74eec39d615bcd0d4ea154efff5bb8b3c39686f8f48e/68747470733a2f2f706f7365722e707567782e6f72672f6d616c656e6b692f617267696c652f762f737461626c652e737667)](https://packagist.org/packages/malenki/argile) [![Total Downloads](https://camo.githubusercontent.com/9fa92d0935df497ad7619d451d839e362f7234f487bf8cf0a31664e2793a8766/68747470733a2f2f706f7365722e707567782e6f72672f6d616c656e6b692f617267696c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/malenki/argile) [![Latest Unstable Version](https://camo.githubusercontent.com/151b7ac06a27a6fa2b3ebe541cf7b7f7f3737e269c4da7798dbebfe064499bc0/68747470733a2f2f706f7365722e707567782e6f72672f6d616c656e6b692f617267696c652f762f756e737461626c652e737667)](https://packagist.org/packages/malenki/argile) [![License](https://camo.githubusercontent.com/f719718891927d28d1f6326d42e94eb3c2fa859bea005ec135fd8e2c10733c20/68747470733a2f2f706f7365722e707567782e6f72672f6d616c656e6b692f617267696c652f6c6963656e73652e737667)](https://packagist.org/packages/malenki/argile)

Create, get, write options and autogenerated help messages for your CLI PHP applications…

Basic usage about values and switches
-------------------------------------

[](#basic-usage-about-values-and-switches)

Quick first simple example with only one switch:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();

$opt->newSwitch('switch')
    ->short('s')
    ->help('I am a very simple switch arg with only short form.')
    ;

$opt->parse();

if($opt->has('switch'))
{
    printf("\"switch\" arg selected!\n");
}
exit();
```

So, if your PHP CLI application is into `yourapp` executable file, then you can call it like that:

```
$ yourapp -s
"switch" arg selected!

```

Without options, calling it will give help message:

```
$ yourapp
Usage: complex.php [OPTIONS]…

  -s                         I am a very simple switch arg with only short
                             form.

  -h, --help                 Display this help message and exit

```

Second example with switch, values, short, long and required options:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();

$opt->newSwitch('switch')
    ->short('s')
    ->help('I am a very simple switch arg with only short form.')
    ;
$opt->newValue('foo')
    ->required()
    ->short('f')
    ->long('foo')
    ->help('I am a simple required arg with short and long forms.')
    ;

$opt->parse();

if($opt->has('switch'))
{
    printf("\"switch\" arg selected!\n");
}

if($opt->has('foo'))
{
    printf("\"foo\" arg selected! Its value is: \"%s\"\n", $opt->get('foo'));
}

exit();
```

Advanced usage of values and switches
-------------------------------------

[](#advanced-usage-of-values-and-switches)

You can **customize variable name** into help text of each option:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();

$opt->newValue('foo')
    ->required()
    ->short('f')
    ->long('foo')
    ->help('I am a simple required value with short and long forms.', 'FILE')
    ;

//...
```

You can **group options together**. Easy, you have to create group, and when you create options, you put the group name has second argument:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();

$opt->addGroup('one', 'Optional title for first group');
$opt->addGroup('two', 'Optional title for second group');

$opt->newSwitch('switch', 'one')
    ->short('s')
    ->help('I am a very simple switch arg with only short form.')
    ;
$opt->newValue('foo', 'one')
    ->required()
    ->short('f')
    ->long('foo')
    ->help('I am a simple required arg with short and long forms.')
    ;
$opt->newValue('bar', 'two')
    ->short('b')
    ->long('bar')
    ->help('I am a simple arg with short and long forms.')
    ;

//...
```

Later, if you can help, options will be grouped and group's name is shown if it has one.

Detect and get arguments
------------------------

[](#detect-and-get-arguments)

Detecting and getting arguments is simple, just use `hasArgument()` and `getArguments()` methods respectively. The second one returns an array.

Meta information about CLI app
------------------------------

[](#meta-information-about-cli-app)

You can define some informations about your app that will be used into help message:

- Synopsis (you can add several synopsis lines, see example files)
- Version
- Description

More
----

[](#more)

You can have "flexible" help output message, that **fit your terminal width**, or you can leave at default with of 80 columns.

If you want this text adjustment, do just following:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();
$opt->flexible(); // yes, that's all

// and add your options and other thing…
```

You can apply **color** and **bold** on labels and options:

```
use Malenki\Argile\Options as Options;

$opt = Options::getInstance();
$opt->labelColor('red'); // color for labels
$opt->optColor('red'); // color for options
$opt->bold(); // labels and options becomes bold

// and add your options and other thing…
```

Colors’ names are the same as foreground colors defined into [Ansi](https://github.com/malenkiki/ansi) project.

To see Argile in action, please look at `examples` directory and run scripts inside it!

MIT Open Source License
-----------------------

[](#mit-open-source-license)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

8

Last Release

4515d ago

Major Versions

1.0 → 2.02013-08-19

2.5 → 3.02014-02-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/6af62130bd16d4e6bbaa5877829b6377386ef9fb6593592052dbb6eeb87c4a02?d=identicon)[malenki](/maintainers/malenki)

---

Top Contributors

[![malenkiki](https://avatars.githubusercontent.com/u/195776?v=4)](https://github.com/malenkiki "malenkiki (67 commits)")

---

Tags

cliargoptget

### Embed Badge

![Health badge](/badges/malenki-argile/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B13.9k](/packages/symfony-console)[nunomaduro/collision

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

4.7k357.7M11.1k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k271.5M386](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.1k19.1M407](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68227.8M374](/packages/wp-cli-php-cli-tools)[socialengine/sniffer-rules

A Lumen 5 and Laravel 5 SquizLabs Code Sniffer 2.0 artisan command. Detect violations of a defined coding standard. It helps your code remains clean and consistent.

1348.3k1](/packages/socialengine-sniffer-rules)

PHPackages © 2026

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