Download the PHP package martijnvdb/php-cli without Composer

On this page you can find all versions of the php package martijnvdb/php-cli. 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 php-cli

PHP CLI

This library helps you to create CLI applications quicky.

Installation

You can install the package via composer:

Usage

Add the composer autoloader to your application and create a new instance of the CLI class. To run the application, use the run() method. This example will be placed in a file called myapp (without the .php extension).

To add a default command to the application use the add() method. Use a callback function as the first argument. This callback will be called without giving any extra arguments. To execute the script, run php myapp.

The add() method can also be used to register a command to your application. This example will be executed by running php myapp helloworld.

Using the $options variable

The $options object will contain all the command line arguments. You can retrieve the values using the all() and get() methods. The example will return the following while running php myapp helloworld --message "Hello, World!"'.

Using the $output variable

The $output object will help you formatting your output.

BB Code

This library support a custom version of BB code to help you style your output. You can mix and match any tags as long as they start with an opening and closing tag.

Styling

These will change the style of the text.

[bold], [b], [dim], [italic], [i], [underline], [u], [blink], [inverse], [reverse], [invisible], [strikethrough], [s]

Text colors

These will change the color of the text.

[black],[red],[green],[yellow],[blue],[magenta],[cyan],[white]

Background colors

These will change the background color of the text.

[bg:black], [bg:red], [bg:green], [bg:yellow], [bg:blue], [bg:magenta], [bg:cyan], [bg:white]

$output Methods

The $output object contains the following methods:

Basic text

Four basis text output methods. The only difference between them is how they handle new lines.

Version

Output the current version of the application.

Columns

Output a formatted column. The $rows variable is an array containing arrays in which each entry is a cell. The $column_styles variable allows you to style a full column in the same style. You should use the BB code without brackets for this.

Take a look at examples/generate to see some examples of how to use these methods.

Input Helper Class

This library also contains a helper class which allows the application to easily get a specific input of the user.

Example of the choice input helper:

Input methods

Force the use to give an input

If the given input is empty, then a required message will show up.

Set a default

If the user doesn't give an input, the given default value will be returned.

Set the invalid message

The message that will show up when the user enters an invalid input.

Set the input styling

The $options array can be filled with BB code tags without the brackets (eg. ['red', 'bold']).

Progress Helper Class

The Progress class shows a progressbar in the console. Using a float between 0 and 1 as an argument in the set() method, you can set the current percentage of the progressbar. The progressbar will also display how long it is running and the expected remaing time (ETA). The start() method will start the timer for those values. The stop() method will stop the timers and the progressbar.

Progress Customization

You can customize the look of the progressbar using the size(), foreground() and background() methods.


All versions of php-cli with dependencies

PHP Build Version
Package Version
No informations.
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 martijnvdb/php-cli contains the following files

Loading the files please wait ....