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.
Download devsrealm/tonics-console
More information about devsrealm/tonics-console
Files in devsrealm/tonics-console
Package tonics-console
Short Description 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.
License MIT
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
.
Class Details
ProcessCommandLineArgs
This class is responsible for processing command-line arguments.
Constructor
- $args: An array of command-line arguments.
Methods
-
processArgs($args): array
Filters and processes the command-line arguments.
-
passes(): bool
Checks if there are any valid arguments passed.
-
getProcessArgs(): array
Returns the processed arguments.
License
This project is licensed under the MIT License. See the LICENSE
file for details.
All versions of tonics-console with dependencies
ext-intl Version *
ext-fileinfo Version *