2017 © Pedro Peláez
 

library ohconsole

OhConsole PHP CLI

image

rogerthomas84/ohconsole

OhConsole PHP CLI

  • Thursday, May 29, 2014
  • by rogerthomas84
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,258 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

View on Packagist, (*1)

OhConsole

OhConsole is a simple interface to create advanced PHP CLI applications by abstracting the commands into separated classes., (*2)

Theory

Arguments are converted to namespaces. The final route class must be named <your name>Route;, (*3)

For example, the command config get url would look for a class of Config\Get\UrlRoute, (*4)

Quick Start

To get started in a hurry, first create your core command file. Generally this could be bin/console. This file should contain something like this:, (*5)

<?php
include 'vendor/autoload.php'; // Your autoloader.

use OhConsole\OhConsole;
// Map any injectables that you want to pass
$injectables = array(
    'config' => array(
        // Put any configuration here.
    )
);

// Start OhConsole
$command = new OhConsole($argv, $injectables);

// Run OhConsole
$command->run();

Examples

Once you've got your example set up, call your main script (see below) and pass one of the commands defined in the PHP files., (*6)

php bin/console ohconsole examples one
php bin/console ohconsole examples two

Here's a sample script that you can use to get started. Feel free to replace the include's with your autoloader instead., (*7)

<?php
include 'vendor/autoload.php'; // Your autoloader.

use OhConsole\OhConsole;

include 'OhConsole/Examples/ExampleOneRoute.php';
include 'OhConsole/Examples/ExampleTwoRoute.php';

$injectables = array(
    'config' => array(
        'db.name' => 'MyDatabaseName',
        'db.user' => 'root',
        'db.password' => 'password',
    )
);

$command = new OhConsole($argv, $injectables);
$command->run();

The Versions

29/05 2014

dev-master

9999999-dev https://github.com/rogerthomas84/ohconsole

OhConsole PHP CLI

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

ohconsole

14/12 2013

1.0.3

1.0.3.0 https://github.com/rogerthomas84/ohconsole

OhConsole PHP CLI

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

ohconsole

14/12 2013

1.0.2

1.0.2.0 https://github.com/rogerthomas84/ohconsole

OhConsole PHP CLI

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

ohconsole

12/12 2013

1.0.1

1.0.1.0 https://github.com/rogerthomas84/ohconsole

OhConsole PHP CLI

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

ohconsole

12/12 2013

1.0.0

1.0.0.0 https://github.com/rogerthomas84/ohconsole

OhConsole PHP CLI

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

ohconsole