Download the PHP package jdwx/args without Composer

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

jdwx/args

PHP library for handling command-line arguments

It's designed to provide methods for safely retrieving most common argument types, including strings, integers, floating point values, boolean flags, sets of keywords, filenames, hostnames, IP addresses, and email addresses.

It's useful for handling arguments presented to a PHP script on the shell command line, e.g.:

Or it could refer to the arguments on a command entered into a PHP-based REPL, such as a custom management tool.

Installation

You can require it directly with Composer:

Or download the source from GitHub: https://github.com/jdwx/args.git

Requirements

This library requires PHP 8.2 or later. It might work with earlier versions of PHP 8, but it has not been tested with them.

Usage

All "shift" methods throw an exception if an argument exists but is invalid:

The default form of such methods returns null if no more arguments are present, which is useful for iterating in a while loop:

The shift methods also provide a variant that throws an exception if no more arguments are present. This is useful for ensuring that a required argument is present:

It is also possible to "peek" at the next argument without necessarily consuming it. This is supported for strings that match a certain prefix:

or for strings in set of keywords:

`

The library also provides handling for optional Gnu-style arguments that begin with two hyphens (e.g., --example):

The handleOptions() method supports both boolean flags (e.g., --flag and --no-flag) and arguments that require a value (e.g., --key=value).

The handleOptions() method removes parsed arguments from the list, allowing remaining arguments to be handled as normal.

It does not support short options (e.g., -h) or options that require a value to be specified in the next argument (e.g., -k value).

Stability

This library is considered stable and is used in production code. Additional parsing methods may be added in the future, but existing methods should not be removed or changed in a way that breaks backwards compatibility. Exceptions to address security issues or bugs may occur, but are expected to be rare.

History

This library has been in use for many years. It was refactored out of a larger codebase in 2023 and was first released as a standalone library in 2024.


All versions of args with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2.0
ext-mbstring Version *
jdwx/param Version ^1.1
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 jdwx/args contains the following files

Loading the files please wait ....