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

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

strukt/console
==============

Strukt CLI Console

1.0.0(1y ago)19975MITPHPPHP &gt;=7.0

Since Apr 29Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (5)

Strukt Console
==============

[](#strukt-console)

[![Build Status](https://camo.githubusercontent.com/bc70681b2acb7dd38e30effade95ab958acc92989d8f8ecd5709a432c1a4ed62/68747470733a2f2f7472617669732d63692e6f72672f706974736f6c752f737472756b742d636f6e736f6c652e7376673f6272616e63683d6d6173746572)](https://packagist.org/packages/strukt/console)[![Latest Stable Version](https://camo.githubusercontent.com/3229ecf47d3bdcfd363dac033e7fc5cf6a1c2774f47912c29df9cc5dd463c4ae/68747470733a2f2f706f7365722e707567782e6f72672f737472756b742f636f6e736f6c652f762f737461626c65)](https://packagist.org/packages/strukt/console)[![Total Downloads](https://camo.githubusercontent.com/832bfb0bd30d57edd012486a1e34034b163ca28076daf300b883547e8870257b/68747470733a2f2f706f7365722e707567782e6f72672f737472756b742f636f6e736f6c652f646f776e6c6f616473)](https://packagist.org/packages/strukt/console)[![Latest Unstable Version](https://camo.githubusercontent.com/70bf78d011af9580d98baf274da606a90e83d60afb3f532b8ceee2596f67945c/68747470733a2f2f706f7365722e707567782e6f72672f737472756b742f636f6e736f6c652f762f756e737461626c65)](https://packagist.org/packages/strukt/console)[![License](https://camo.githubusercontent.com/04ab304248c20af866e7b5b4cf0b75a7db0244f370d73d3481e7ba06ee83321c/68747470733a2f2f706f7365722e707567782e6f72672f737472756b742f636f6e736f6c652f6c6963656e7365)](https://packagist.org/packages/strukt/console)

This is a console framework that utilises `DocBlock` to parse command description and format.

Block Spaces (IMPORTANT)
------------------------

[](#block-spaces-important)

This package uses `DocBlock` to generate your commands. The `DocBlock` must be in single spaces and *NOT* tabs. Be conservative with the spaces and don't leave any that are unnecessary otherwise the commands will not work.

Usage
-----

[](#usage)

Sample Command:

```
namespace Command;

use Strukt\Console\Input;
use Strukt\Console\Output;
use \Strukt\Console\Command as AbstractCommand;

/**
* mysql:auth          MySQL Authentication
*
* Usage:
*
*      mysql:auth  --username  --password  [--host ]
*
* Arguments:
*
*      database  MySQL database name - optional argument
*
* Options:
*
*      --username -u   MySQL Username
*      --password -p   MySQL Password
*      --host -h       MySQL Host - optional default 127.0.0.1
*/
class MySQLAuth extends AbstractCommand{

	public function execute(Input $in, Output $out){

		$out->add(sprintf("%s:%s:%s",
							$in->get("database"),
							$in->get("username"),
							$in->get("password")));
	}
}
```

Add this in your executable file:

```
#!/usr/bin/php
