PHPackages                             drwcli/pattern - 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. drwcli/pattern

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

drwcli/pattern
==============

Drwcli Pattern Template

v1.0(6y ago)03MITPHP

Since Apr 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/walegbenga/drwcli-pattern)[ Packagist](https://packagist.org/packages/drwcli/pattern)[ Docs](https://github.com/walegbenga/drwcli/pattern)[ RSS](/packages/drwcli-pattern/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

drwcli
======

[](#drwcli)

[Drwcli](https://github.com/gbengawale/drwcli) is a dependency-free toolkit for building CLI-only applications in PHP created by @walegbenga. This repository is a template you can use to create a new application that has a single dependency: `drwcli/drwcli`.

### Why drwcli

[](#why-drwcli)

The current trend in software development is basing your project on a big pile of unknowns. There is nothing wrong in using third party software, but if more than 80% of your application is out of your control, things can get messy. What usually happens is that you don't even know what packages you're depending on, when using the most popular frameworks.

It can be used for microservices, personal dev tools, bots and little fun things.

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

[](#getting-started)

You'll need `php-cli` and [Composer](https://getcomposer.org/) to get started.

Create a new project with:

```
composer create-project --prefer-dist drwcli/application myapp

```

Once the installation is finished, you can run `drwcli` it with:

```
cd myapp
./drwcli

```

This will show you the default app signature:

```
usage: ./drwcli help

```

The default `help` command that comes with drwcli (`app/Command/Help/DefaultController.php`) auto-generates a tree of available commands:

```
./drwcli help

```

```
Available Commands

help
└──test

```

The `help test` command, defined in `app/Command/Help/TestController.php`, shows an echo test of parameters:

```
./minicli help test user=gbenga name=value

```

```
Hello, gbenga!

Array
(
    [user] => gbenga
    [name] => value
)

```

### The simplest app

[](#the-simplest-app)

The simplest drwcli script doesn't require using Command Controllers at all. You can delete the `app` folder and use `registerCommand` with an anonymous function, like this:

```
#!/usr/bin/php
