PHPackages                             tomnomnom/phargs - 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. tomnomnom/phargs

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

tomnomnom/phargs
================

A toolkit for writing CLI scripts in PHP

0.0.5(13y ago)26532MITPHP

Since Dec 22Pushed 10y ago2 watchersCompare

[ Source](https://github.com/TomNomNom/phargs)[ Packagist](https://packagist.org/packages/tomnomnom/phargs)[ Docs](https://github.com/TomNomNom/phargs/)[ RSS](/packages/tomnomnom-phargs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

Phargs
======

[](#phargs)

Phargs is a toolkit for writing CLI scripts in PHP; it was born out of frustration, anger, and boilerplate déjà vu. Pull requests, issues, and suggestions are always welcome.

Phargs' main asset is its argument processor, but the output tools are pretty useful too.

Everything in Phargs is available through `\Phargs\Factory`.

Contents
--------

[](#contents)

This README file is a little long, so here's a breakdown of the contents:

- [Installation](#installation)
- [Argument processing](#argument-processing)
    - [Flags - Intro](#flags)
    - [Flags - Basic usage](#basic-usage)
    - [Flags - Flag aliases](#flag-aliases)
    - [Flags - Compound flags](#compound-flags)
    - [Params - Intro](#params)
    - [Params - Basic usage](#basic-usage-1)
    - [Params - Param aliases](#param-aliases)
    - [Params - Required params](#required-params)
    - [Residual args](#residual-args)
- [Outputting to the screen](#outputting-to-the-screen)
    - [Basic usage](#basic-usage-2)
    - [Colors](#colors)
- [Prompting for input](#prompting-for-input)
    - [Basic usage](#basic-usage-3)
    - [Required input](#required-input)
- [Formatting](#formatting)
    - [Tables](#tables)
    - [TSV](#tsv)
- [Requirements](#requirements)
- [Testing](#testing)

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

[](#installation)

Phargs is available on [Packagist](https://packagist.org/packages/tomnomnom/phargs) so you can install it using [Composer](http://getcomposer.org/). Just specify it as a dependency in your `composer.json`:

```
{
    "require": {
        "tomnomnom/phargs": "0.0.5"
    }
}
```

Then run `composer install`:

```
▶ composer install
Loading composer repositories with package information
Installing dependencies
  - Installing tomnomnom/phargs (0.0.2)
    Loading from cache

Writing lock file
Generating autoload files

```

Once installed you can use the composer autoloader instead of the `Phargs/Init.php` script that the included examples use:

```
