PHPackages                             stefaminator/php-cli-cmd - 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. stefaminator/php-cli-cmd

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

stefaminator/php-cli-cmd
========================

The PHP CLI CMD library

654[1 PRs](https://github.com/Stefaminator/php-cli-cmd/pulls)PHPCI passing

Since Jun 16Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/Stefaminator/php-cli-cmd)[ Packagist](https://packagist.org/packages/stefaminator/php-cli-cmd)[ RSS](/packages/stefaminator-php-cli-cmd/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

php-cli-cmd
===========

[](#php-cli-cmd)

**The PHP CLI CMD library. Helps you create well-structured PHP CLI apps quickly and easily.**

This library supports setting up options and arguments, subcommands and offers an integrated command help. Use the color or progress bar helpers to visualize important outputs.

[![Packagist PHP Version Support](https://camo.githubusercontent.com/6bd9b429571d84832060d594ee9efa6bc5f3a7cdbcfbe43d2808d64f4a7ac188/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73746566616d696e61746f722f7068702d636c692d636d64)](https://camo.githubusercontent.com/6bd9b429571d84832060d594ee9efa6bc5f3a7cdbcfbe43d2808d64f4a7ac188/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73746566616d696e61746f722f7068702d636c692d636d64)[![Latest Stable Version](https://camo.githubusercontent.com/a9cfec48383f77bfa8b0d45ec4f28dee0b503646a9513112ea5cd3c963dd304d/68747470733a2f2f706f7365722e707567782e6f72672f73746566616d696e61746f722f7068702d636c692d636d642f76)](https://packagist.org/packages/stefaminator/php-cli-cmd)[![Build Status](https://camo.githubusercontent.com/fafed081d4975afdec7de4bcdbdba3cef270c42bfa5a5dd53ba25c70d652d6f8/68747470733a2f2f7472617669732d63692e636f6d2f53746566616d696e61746f722f7068702d636c692d636d642e7376673f746f6b656e3d73773157734477727841364464666f5965697872266272616e63683d6d6173746572)](https://travis-ci.com/Stefaminator/php-cli-cmd)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9c0c67d8bb254db5d1ae197960161ee8667677f532c88f2117fa70a91ebbfc43/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53746566616d696e61746f722f7068702d636c692d636d642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Stefaminator/php-cli-cmd/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/199510be2338672ca480bc53adbe6e424db6580e410800991f78a45723457513/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53746566616d696e61746f722f7068702d636c692d636d642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Stefaminator/php-cli-cmd/?branch=master)[![Packagist License](https://camo.githubusercontent.com/7d8c9729ea058039f46c1add208bdf6064bb6192f98188a4d2b050f8a4da154c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73746566616d696e61746f722f7068702d636c692d636d64)](https://camo.githubusercontent.com/7d8c9729ea058039f46c1add208bdf6064bb6192f98188a4d2b050f8a4da154c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73746566616d696e61746f722f7068702d636c692d636d64)

Table of Contents
-----------------

[](#table-of-contents)

- [Getting started](#getting-started)
- [Build your first app](#build-your-first-app)
- [Options](#options)
- [Arguments](#arguments)
- [Subcommands](#subcommands)

Getting started
---------------

[](#getting-started)

The simplest way of installing ist to refer to the sources on packagist.

```
composer require stefaminator/php-cli-cmd

```

Build your first app
--------------------

[](#build-your-first-app)

Let's start by creating a new php file called `cli-app-helloworld.php` and require composers autoloader.

Create a custom class by extending `Stefaminator\Cli\App` and implement the required `setup` method which must return an instance of `Stefaminator\Cli\Cmd`. In the following example we created a root `Cmd`and put the lines to execute for that root command into the `run` method.

Finally, call the apps `run()` method and feel the magic.

(You can will this example here: [examples/cli-app-helloworld.php](./examples/cli-app-helloworld.php))

```
