PHPackages                             aura/cli - 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. aura/cli

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

aura/cli
========

Provides the equivalent of request (Context) and response (Stdio) classes for a command line environment, including Getopt support.

2.2.0(9y ago)1051.6M↑22.8%20[1 PRs](https://github.com/auraphp/Aura.Cli/pulls)20BSD-2-ClausePHPPHP &gt;=5.3.0

Since Nov 27Pushed 1y ago14 watchersCompare

[ Source](https://github.com/auraphp/Aura.Cli)[ Packagist](https://packagist.org/packages/aura/cli)[ Docs](https://github.com/auraphp/Aura.Cli)[ RSS](/packages/aura-cli/feed)WikiDiscussions 4.x Synced 1mo ago

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

Aura.Cli
========

[](#auracli)

Provides the equivalent of request ( *Context* ) and response ( *Stdio* ) objects for the command line interface, including *Getopt* support, and an independent *Help* object for describing commands.

Foreword
--------

[](#foreword)

### Installation

[](#installation)

This library requires PHP 7.2 or later; we recommend using the latest available version of PHP as a matter of principle.

It has no userland dependencies.

It is installable and autoloadable via Composer as [aura/cli](https://packagist.org/packages/aura/cli).

Alternatively, [download a release](https://github.com/auraphp/Aura.Cli/releases) or clone this repository, then require or include its *autoload.php* file.

### Quality

[](#quality)

[![Continuous Integration](https://github.com/auraphp/Aura.Cli/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/auraphp/Aura.Cli/actions/workflows/continuous-integration.yml)

To run the unit tests at the command line, issue `composer install` and then `composer test` at the package root. This requires [Composer](http://getcomposer.org/) to be available as `composer`.

This library attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

### Community

[](#community)

To ask questions, provide feedback, or otherwise communicate with the Aura community, please join our [Google Group](http://groups.google.com/group/auraphp), follow [@auraphp on Twitter](http://twitter.com/auraphp), or chat with us on #auraphp on Freenode.

Getting Started
---------------

[](#getting-started)

### Context Discovery

[](#context-discovery)

The *Context* object provides information about the command line environment, including any option flags passed via the command line. (This is the command line equivalent of a web request object.)

Instantiate a *Context* object using the *CliFactory*; pass it a copy of `$GLOBALS`.

```

```

You can access the `$_ENV`, `$_SERVER`, and `$argv` values with the `$env`, `$server`, and `$argv` property objects, respectively. (Note that these properties are copies of those superglobals as they were at the time of *Context* instantiation.) You can pass an alternative default value if the related key is missing.

```
