Download the PHP package siktec/just-cli without Composer

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

Just CLI

[!NOTE] Just CLI is a fork of adhocore/php-cli which is an amazing CLI framework. This fork is for adding some features that may not be suitable for the original project. Some of the features are:

  • [x] Negative numbers in arguments.
  • [x] Support for multiple variadic arguments with a grouping option (e.g. $ app cmd [arg11 arg12] --opt [val1 val2] )
  • [ ] Add support for a structured CLI app that will auto register commands, views, layouts, etc.
  • [ ] Add support for Themes.

Framework agnostic Command Line Interface utilities and helpers for PHP. Build Console App with ease, fun and love.

Screen Preview

What's included

Core: Shell

IO: Stream reader

Other: Autocompletion

Installation

Usage

Argv parser

Command help

It can be triggered manually with $command->showHelp() or automatic when -h or --help option is passed to $command->parse().

For above example, the output would be: Command Help

Command version

It can be triggered manually with $command->showVersion() or automatic when -V or --version option is passed to $command->parse().

For above example, the output would be:

Console app

Here we simulate a git app with limited functionality of add, and checkout. You will see how intuitive, fluent and cheese building a console app is!

Git app

Organized app

Instead of inline commands/actions, we define and add our own commands (having interact() and execute()) to the app:

Grouping commands

Grouped commands are listed together in commands list. Explicit grouping a command is optional. By default if a command name has a colon : then the part before it is taken as a group, else * is taken as a group.

Example: command name app:env has a default group app, command name appenv has group *.

Exception handler

Set a custom exception handler as callback. The callback receives exception & exit code. The callback may rethrow exception or may exit the program or just log exception and do nothing else.

App help

It can be triggered manually with $app->showHelp() or automatic when -h or --help option is passed to $app->parse(). Note If you pass something like ['app', cmd', '-h'] to $app->parse() it will automatically and instantly show you help of that cmd and not the $app.

For above example, the output would be: App Help

App version

Same version number is passed to all attached Commands. So you can trigger version on any of the commands.

Shell

Very thin shell wrapper that provides convenience methods around proc_open().

Basic usage

Advanced usage

Timeout

Cli Interaction

You can perform user interaction like printing colored output, reading user input programatically and moving the cursors around with provided JCli\IO\Interactor.

Confirm

Single choice

Multiple choices

Prompt free input

Prompt with validation

Prompt hidden

On windows platform, it may change the fontface which can be fixed.

Interactive Preview

IO Components

The interactor is composed of JCli\Input\Reader and JCli\Output\Writer while the Writer itself is composed of JCli\Output\Color. All these components can be used standalone.

Color

Color looks cool!

Simple usage

Custom style

Cursor

Move cursor around, erase line up or down, clear screen.

Progress Bar

Easily add a progress bar to your output:

You can also manually advance the bar:

You can override the progress bar options to customize it to your liking:

Writer

Write anything in style.

Output formatting

You can call methods composed of any combinations: '<colorName>', 'bold', 'bg', 'fg', 'warn', 'info', 'error', 'ok', 'comment' ... in any order (eg: bgRedFgBlack, boldRed, greenBold, commentBgPurple and so on ...)

Free style

Many colors with one single call: wrap text with tags <method> and </end> For NL/EOL just use <eol> or </eol> or <eol/>.

Great for writing long colorful texts for example command usage info.

Raw output

Tables

Just pass array of assoc arrays. The keys of first array will be taken as heading. Heading is auto inflected to human readable capitalized words (ucwords).

Gives something like:

Designing table look and feel

Just pass 2nd param $styles:

Reader

Read and pre process user input.

Exceptions

Whenever an exception is caught by Application::handle(), it will show a beautiful stack trace and exit with non 0 status code.

Exception Preview

Autocompletion

Any console applications that are built on top of siktec/just-cli can entertain autocomplete of commands and options in zsh shell with oh-my-zsh.

All you have to do is add one line to the end of ~/.oh-my-zsh/custom/plugins/ahccli/jcli.plugin.zsh:

compdef _jcli <appname>

Example: compdef _jcli your-cli-app for your cli app named your-cli-app

That is cumbersome to perform manually, here's a complete command you can copy/paste/run:

One time setup

Load JCli plugin

This is also one time setup.

Registering app

Of course you can add multiple apps, just change appname in above command

Then either restart the shell or source the plugin like so:

Trigger autocomplete

Original Authors and Contributors:


All versions of just-cli with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 siktec/just-cli contains the following files

Loading the files please wait ....