Download the PHP package minicli/minicli without Composer

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

logo

Latest Stable Version Total Downloads License Documentation Status

Minicli

Minimalist, dependency-free framework for building CLI-centric PHP applications


Minicli is a minimalist, dependency-free framework for building CLI-centric PHP applications. It provides a structured way to organize your commands, as well as various helpers to facilitate working with command arguments, obtaining input from users, and printing colored output.

Quick links:

Dependency-free: What Does it Mean

What does it mean to be dependency-free? It means that you can build a working CLI PHP application without dozens of nested user-land dependencies. The basic minicli/minicli package has only testing dependencies, and a single system requirement:

Note: If you want to obtain user input, then the readline PHP extension is required as well.

It gives you a lot of room to choose your own dependencies.

Getting Started

There are two ways to get started. If you want the bare minimum, what we'll call "Minimalist App", you can create a single PHP script with your whole application. If you want a more structured application, with commands and subcommands, then you should use Command Namespaces to organize your commands into Controllers.

Minimalist App

If you just want to set up a few simple commands to run through minicli, all you need to do is to create an App and register your commands as anonymous functions.

  1. Create an empty project
  2. Run composer require minicli/minicli - this will generate a new composer.json file.
  3. Create a minicli script with the following content:

Then, make it executable and run minicli with your command:

Structured App (Recommended)

For a more structured application using Controllers and Services, it's best to use Command Namespaces. Our application template repository is a great starting point / template to set up Minicli that way.

To create a new project using the minicli/application template, run:

This will generate a directory structure like the following:

Each directory inside app/Command represents a Command Namespace. The classes inside app/Command/Help represent subcommands that you can access through the main help command.

You can now run the bootstrapped application with:

The documentation contains more detailed information about creating commands and working with output.

Color Themes

Minicli supports the use of color themes to change the style of command line output. There is currently 3 built-in themes other than the default theme:

To set the theme, pass in a configuration array with a theme value when initializing App in the script. Built-in themes need a leading \ character:

To use the default built-in theme, do not include the theme configuration setting, or set it to an empty string.

User-defined themes can also be created and defined in your project. In this case, set the theme name including its namespace without a leading \:

The above setting would use the following example theme:

User-defined themes only need to define styles which will override those in the default theme.

Contributing

Contributions are very welcome! You can contribute with code, documentation, filing issues... Please refer to our contributing doc for more information on the contribution process and what we expect from you.

Running the Test Suite

Minicli uses Pest PHP as testing framework. Once you have all dependencies installed via composer install, you can run the test suite with:

To obtain the code coverage report, you'll need to have xdebug installed. Then, you can run:

And this will give you detailed information about code coverage.

Building Minicli

The following tutorials on dev.to compose a series named "Building Minicli", where we create minicli from scratch:

Note: Minicli has evolved a lot since that series was initially written, but that was the base for what Minicli is today.


All versions of minicli with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-readline Version *
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 minicli/minicli contains the following files

Loading the files please wait ....