Download the PHP package cheprasov/php-cli-args without Composer

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

MIT license

CliArgs v3.0.0 for PHP >= 5.5

About

Class CliArgs helps to get options from the command line argument list easy.

Features

Note

This class is not workable when register_argc_argv is disabled.

Usage

Example

run

example.php

Config

Note: all params from cli that you want to use should be specified in config, otherwise they will be ignored.

Examples of config:

Example 1

Example 2

Example 3

Example 4

Create a new instance

Methods

new CliArgs(array|null $config = null)

Constructor. If config contents wrong aliases then ConfigErrorException will be thrown.

getArgs(): array

The method returns all passed arguments which is specified in config.

getArg(string $key): mixed | null

Returns value for argument by key. If argument is not set, then it will return default value or null

isFlagExist(string $key, boolean $checkAlias = true): bool

Return true if key exists, otherwise the method returns false If $checkAlias is true, then the method will check key and alias, and will return true if key or alias exists. If $checkAlias is false, then the method will check only key and will return true only if key exists.

getArguments(): array

Get prepared arguments from ARGV

geHelp([string $value = null]): string

Get help

Installation

Composer

Download composer:

wget -nc http://getcomposer.org/composer.phar

and add dependency to your project:

php composer.phar require cheprasov/php-cli-args

Running tests

./vendor/bin/phpunit

Something doesn't work

Feel free to fork project, fix bugs and finally request for pull (do not forget write tests please)


All versions of php-cli-args with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
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 cheprasov/php-cli-args contains the following files

Loading the files please wait ....