library kryuu-cool-console
An extension of the console modules in ZF2, this handles boxes grid views and more.
katsuo-ryuu/kryuu-cool-console
An extension of the console modules in ZF2, this handles boxes grid views and more.
- Saturday, May 7, 2016
- by KatsuoRyuu
- Repository
- 1 Watchers
- 0 Stars
- 1 Installations
- PHP
- 1 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
About Cool Console
This is a module that helps building a more nice interface when the ZF2 application is running in console view.
At this stage it's still in the beta stage and need a lot of improvements, like more advanced selectors lists and more., (*1)
Installation
Main Setup
With composer
-
Add this project and KryuuCoolConsole in your composer.json:, (*2)
"require": {
"katsuo-ryuu/kryuu-cool-console": "dev-master"
}
-
Now tell composer to download KryuuCoolConsole by running the command:, (*3)
$ php composer.phar update
Creating a simple view
NOTICE The system currently only have one view type "grid", (*4)
<?php
// Create a new view
$view = new Grid();
// Create a nice box with a padding of 1 and a margin of 1
// and make it with double borders
$box = new Box(1,1, Border::BORDER_DOUBLE);
// Setting the background color of the box
$box->setBgColor(Color::BC_MARINE);
// Create a selection list
$choiseList = new ChoiceList();
// Setting the items in the selection list
$choiseList->setItems(['item 1', 'item 2', 'item 3']);
// Adding a nice headline to the list
$choiseList->setHeadline('Please select an item');
// Add the choice list to the box container
$box->addChild($choiseList);
// Add the box to the grid view
$view->addChild($box);
// show the actual view in the terminal
$view->show();