Download the PHP package hunomina/cli-oop-php without Composer
On this page you can find all versions of the php package hunomina/cli-oop-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hunomina/cli-oop-php
More information about hunomina/cli-oop-php
Files in hunomina/cli-oop-php
Package cli-oop-php
Short Description Implementation of CLI classes for PHP7.1 or higher
License proprietary
Informations about the package cli-oop-php
CLI OOP PHP
Description : Implementation of CLI classes for PHP7.1 or higher.
This class can be used in a php file called by a CLI with input redirection.
Console
The hunomina\Console\Console class allow you to create script that you can use for background tasks, cron tasks...
To instantiate a Console, you have to pass a folder path to the constructor. This path is where your commands locate.
The folder is then sort out and only files will be parsed.
The Console parses all the files and store all class implementing the hunomina\Command\CommandInterface in the $_commands attribute
The execute($params) method allow you to execute commands.
It the parameters match a command, it will execute it.
If it does not, it will return a failure message.
If $params is null, an empty array or equals to "['help']", the console will print all the available commands.
The console will also print a message based on the command success.
CommandInterface
The hunomina\Command\CommandInterface has 3 methods :
- array getCommand() : Return a list of string composing the command
- string getDescription() : Return the string description of the command (used by the help command)
- bool execute() : Logic of the command. Return true on success and false on failure
Examples
See /tests for examples