Download the PHP package devsrealm/tonics-console without Composer

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

Tonics Console

Tonics Console is a PHP-based command-line argument processing library. It allows you to easily parse and handle command-line arguments in your PHP applications.

Installation

To install Tonics Console, you can use Composer:

Usage

Basic Example

Here's a basic example of how to use the ProcessCommandLineArgs class to parse command-line arguments:

Output

The above code will output:

Here is an additional example demonstrating how to use the ProcessCommandLineArgs class to handle different types of command-line arguments:

Advanced Example

This example shows how to handle both required and optional arguments, as well as how to check if the arguments were passed correctly.

Output

The above code will output:

This example demonstrates how to parse and access individual command-line arguments, including handling optional flags like -v.

Advanced Features

Repeated Keys Example

Parsed structure snippet:

Wildcard Required Patterns in Commands

A command can express its requirements with wildcards:

ArgsHelper Quick Reference

Optional Description Interface

For commands that want to expose metadata without affecting behavior, implement:

Command Specificity and Matching

When multiple commands have overlapping requirements, the console automatically matches the most specific command first (the one with the most required arguments). This ensures correct behavior when you have commands with subset/superset requirements.

Example:

When you run:

The system will match MigrateAllFresh (2 required args) instead of MigrateAll (1 required arg), ensuring the correct command executes regardless of registration order.

When you run:

The system will match MigrateAll since MigrateAllFresh is missing the --fresh requirement.

Class Details

ProcessCommandLineArgs

This class is responsible for processing command-line arguments.

Constructor

Methods

Testing with Kahlan

Specs are located in the spec/ directory. Run the test suite with:

Kahlan coverage/reporters are not required for this project; the default output is sufficient.

License

This project is licensed under the MIT License. See the LICENSE file for details.


All versions of tonics-console with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
ext-intl Version *
ext-fileinfo Version *
ext-mbstring 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 devsrealm/tonics-console contains the following files

Loading the files please wait ...