Download the PHP package afeefa/cli-app without Composer
On this page you can find all versions of the php package afeefa/cli-app. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download afeefa/cli-app
More information about afeefa/cli-app
Files in afeefa/cli-app
Package cli-app
Short Description Convenient wrapper around symfony console
License MIT
Homepage https://github.com/afeefacode/cli-app
Informations about the package cli-app
afeefa/cli-app
Create a symfony/console
PHP cli app with a minimum of configuration.
Description
At times a project might need a cli tool to perform some configuration, installation or maintenance work. It shouldn't be much effort to get one running. This package is a convenience wrapper around the PHP's symfony/console framework and aims to simplify the creation of cli apps. It provides:
- a fluent interface to create (nested) commands
- selectable (sub) commands and command arguments
- reusable actions
- helper functions for input, output and process execution
Installation
Install via composer as usual. Most probably you use the cli for dev purposes:
Documentation
See the examples below for inspiration and head over to the documentation pages:
- Read the Docs on installation, configuration and usage
- the API Documentation
Examples
- Basic Workflow
- Command Actions
- Command Arguments
- Nested Commands
Example 1: Basic workflow
The most basic example shows the workflow of cli-app
. You create one or more commands (usually in a separate file) and add those commands to the application instance by providing a command name and a description.
File: pets.php
Run the example:
Example 2: Command Actions
The examples shows three things:
- an action, which is kind of a lightweight command, that can be called from any command or action
- a prompt, which lets the user select from a list of choices
- and a possibility to reuse a command by giving it a mode
Run the example:
Example 3: Command Arguments
Command arguments are a basic cli feature. If you want to help the user by providing a list of argument values to choose from, you can use selectable arguments. The example shows:
- using and consuming selectable arguments
- setting a default command
Run the example:
Example 4: Nested Commands
The example shows:
- the configuration of nested commands
- the ability to inspect a commands or a command parent's name.
Run the example:
All versions of cli-app with dependencies
afeefa/debug-dump-log Version ^0
symfony/console Version ^v5.4 || ^v6.1
symfony/filesystem Version ^v5.4 || ^v6.1
symfony/process Version ^v5.4 || ^v6.1
twig/twig Version ^v3.4
wujunze/php-cli-color Version ^v2.4