Download the PHP package fyre/command without Composer
On this page you can find all versions of the php package fyre/command. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package command
FyreCommand
FyreCommand is a free, open-source CLI command library for PHP.
Table Of Contents
- Installation
- Methods
- Commands
Installation
Using Composer
In PHP:
Methods
Add Namespace
Add a namespace for loading commands.
$namespace
is a string representing the namespace.
All
Get all available commands.
This method will return an array where the key is the command alias, and the value is an instance of the command.
Clear
Clear all namespaces and loaded commands.
Get Namespaces
Get the namespaces.
Handle
Handle an argv Command.
$argv
is an array containing the CLI arguments.
Has Command
Check if a command exists.
$alias
is a string representing the command alias.
Has Namespace
Check if a namespace exists.
$namespace
is a string representing the namespace.
Remove Namespace
Remove a namespace.
$namespace
is a string representing the namespace.
Run
Run a Command.
$alias
is a string representing the command alias.$arguments
is an array containing arguments for the command, and will default to [].
Commands
Custom commands can be created by extending \Fyre\Command\Command
, suffixing the class name with "Command", and ensuring the run
method is implemented.
Alias
Get the command alias.
The alias can be set by defining the $alias
property on the command, otherwise the class name will be used by default.
Get Description
Get the command description.
The description can be set by defining the $description
property on the command.
Get Name
Get the command name.
The name can be set by defining the $name
property on the command, otherwise the class name will be used by default.
Run
Run the command.
$arguments
is an array containing the command arguments.
This method should return an integer representing the command exit code. The class constants Command::CODE_SUCCESS
and Command::CODE_ERROR
can be used.
All versions of command with dependencies
fyre/container Version ^1.0
fyre/inflector Version ^3.0
fyre/loader Version ^3.0