Download the PHP package asika/joomla-console without Composer

On this page you can find all versions of the php package asika/joomla-console. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package joomla-console

The Console Package

The Joomla Console package provide an elegant and nested command structure for your cli application.

The Command Calling Flow

If we type:

The command calling flow is:

Initialising Console

Console is extends from AbstractCliApplication, help us create a command line application.

An example console application skeleton in cli/console.php file:

The execute() will find commands matched the cli input argument. If there are not any command registered, console will execute the Default Command.

Default Command

RootCommand is a command object extends from base Command object. It provides some useful helper, we can list all commands by typing:

By default, the output is:

Set Executing Code for RootCommand

We can add closure to every commands, that this command will execute this function first. Use setHandler() on $console, the Console will auto pass the code to RootCommand:

This will do same action:

Retype $ php cli/console.php and output:

If we want to get help again, just type:

OR

Note: Command only return integer between 0 and 255, 0 means success, while others means failure or other status. The exit code of Unix/Linux meaning please see: Exit Codes Meanings

Add Help Message to Console

Console includes some help message like: name, version, description, usage and help.

If we add this messages to Console:

The help will show:

help

Add First Level Command to Console

Now, we just use the default command. But there are not first level arguments we can call except HelpCommand.

We can add a command by this code:

Then we type:

We will get:

If we type help:

The foo command description has auto added to default command arguments list.

foo-help

Using My Command Object

We can create our own command object instead setting it in runtime.

This is an example FooCommand:

And we register it in Console:

Using Arguments and Options

We can use this code to get arguments and options

If we type:

OR

The getOption() method will auto detect option aliases, then we can get:

Note: We have to addOption() first, then the getOption('x') is able to get the input option which we wanted.

If we don't do this first, we have to use $this->input->get('x') to get option value, but this way do not support option aliases.

Add Second Level Commands and more...

If we want to add several commands after FooCommand, we can use addCommand() method. Now we add two bar and yoo command to FooCommand.

Adding command in runtime.

We use addCommand() to add commands.

If a command has one or more sub commands, the arguments means to call sub command which name equals to first argument.

If a command has on sub commands, Command object will run executing code if set, or run doExecute() if executing code not set. Then the remaining arguments will save in $this->input->args.

Adding command by classes

We declare BarCommand and YooCommand class first.

Then register them to FooCommand:

OK, typing:

We get:

HelpCommand

HelpCommand will auto generate help list for us.

When we use addCommand(), addOption() and set some description or other information to these objects, they will save all information in it. Then when we type $ cli/console.php help somethine or $ cli/console.php somethine --help, The HelpCommand will return the help message to us.

Every command has these information, you can use setter and getter to access them:

The Console information:

Use Your Own Descriptor

If you want to override the Descriptor for your apps, you can do this:

Use Command Without Console

We can using Command without Console or CliApplicaion, please see Command README.

Installation via Composer

Add "joomla/application": "dev-master" to the require block in your composer.json, make sure you have "minimum-stability": "dev" and then run composer install.

Alternatively, you can simply run the following from the command line:


All versions of joomla-console with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.10
joomla/application Version ~1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package asika/joomla-console contains the following files

Loading the files please wait ....