PHPackages                             webmozart/console - 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. webmozart/console

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

webmozart/console
=================

A usable, beautiful and easily testable console toolkit written in PHP.

1.0.0-beta5(10y ago)212104.6k↓58.3%56[7 issues](https://github.com/webmozart/console/issues)8MITPHPPHP &gt;=5.3.9

Since Mar 19Pushed 9y ago14 watchersCompare

[ Source](https://github.com/webmozart/console)[ Packagist](https://packagist.org/packages/webmozart/console)[ RSS](/packages/webmozart-console/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (7)Versions (7)Used By (8)

Webmozart Console
=================

[](#webmozart-console)

[![Build Status](https://camo.githubusercontent.com/57ca739ba4e9ac6d16998a17dfd1017e240d463e84ae587c43c2ceb09615bd92/68747470733a2f2f7472617669732d63692e6f72672f7765626d6f7a6172742f636f6e736f6c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/webmozart/console)[![Build status](https://camo.githubusercontent.com/c2681f3d14f86d1d74707ee33539526cdfe1ea12f71d4334ba5d8b3356995b1e/68747470733a2f2f63692e6170707665796f722e636f6d2f6170692f70726f6a656374732f7374617475732f6236326c6e626d666b7637353473636f2f6272616e63682f6d61737465723f7376673d74727565)](https://ci.appveyor.com/project/webmozart/console/branch/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/09b29150136472ce620ebf14030ebe897b2cdd0e289e860d84d6f433d1c943a3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7765626d6f7a6172742f636f6e736f6c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/webmozart/console/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/1ddc36340b36ccbc86cf45a718e852ffe4f738ed740fc4b3911af43368dc7486/68747470733a2f2f706f7365722e707567782e6f72672f7765626d6f7a6172742f636f6e736f6c652f762f737461626c652e737667)](https://packagist.org/packages/webmozart/console)[![Total Downloads](https://camo.githubusercontent.com/39869938f6f3d6b8d0c390a68f30e9ad2e2492518ff8ee9d8484ea348717ad37/68747470733a2f2f706f7365722e707567782e6f72672f7765626d6f7a6172742f636f6e736f6c652f646f776e6c6f6164732e737667)](https://packagist.org/packages/webmozart/console)[![Dependency Status](https://camo.githubusercontent.com/7de1b10ea7aeab62e15ed24244aaeba550674da3cc066771042805e82e8b4d4d/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f7765626d6f7a6172743a636f6e736f6c652f312e302e302f62616467652e737667)](https://www.versioneye.com/php/webmozart:console/1.0.0)

Latest release: [1.0.0-beta5](https://packagist.org/packages/webmozart/console#1.0.0-beta5)

PHP &gt;= 5.3.9

A usable, beautiful and easily testable console toolkit written in PHP.

Goal
----

[](#goal)

The goal of this package is:

- to build PHP applications similar to the "git" command
- with a minimum amount of code
- that are testable
- robust
- and beautiful.

None of the existing console libraries matched these requirements, so I refactored the [Symfony Console component](http://symfony.com/doc/current/components/console/introduction.html) into what you can see here.

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

[](#installation)

Use [Composer](https://getcomposer.org/) to install the package:

```
$ composer require webmozart/console:~1.0@beta

```

Basic Configuration
-------------------

[](#basic-configuration)

Console applications are configured via configuration classes. As example, we will create the "git" command in PHP:

```
use Webmozart\Console\Config\DefaultApplicationConfig;

class GitApplicationConfig extends DefaultApplicationConfig
{
    protected function configure()
    {
        parent::configure();

        $this
            ->setName('git')
            ->setVersion('1.0.0')

            // ...
        ;
    }
}
```

This basic configuration tells the console that the executable is called "git" and that the current version is 1.0.0. Let's create the "git" executable now:

```
#!/usr/bin/env php
