Download the PHP package net_bazzline/php_component_cli_arguments without Composer

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

Argument Handling for PHP CLI Scripts

This project aims to deliver a easy to use and free as in freedom php command component.

The build status of the current master branch is tracked by Travis CI: Build Status Latest stable

The scrutinizer status are: code quality | build status

The versioneye status is: Dependency Status

Take a look on openhub.net.

The current change log can be found here.

Install

By Hand

With Packagist

Benefits

Example

Simple call run.php with tons of arguments like illustrated below.

Generates the following output.

Terms

All arguments are grouped into one of three types, flags, lists or values. Argument or parameter? I could not spot a major difference. When I think about parameters, my mind slipps into the domain of methods or functions, thats why I have decided to call them arguments. Furthermore, php.net calls the "argument list" also :-).

Flag

A flag is an argument that changes the behaviour of an command. It acts as a trigger so you can turn things on or off (best example in the world "-h|--help")

The position in a commandcall for a flag is not important, only the existence.

Valid flags are:

List

A list is an argument that contains multiple values per name.

This call

would result into a list with the name "my_list" and two arguments, "argument one" and "argument two".

Lists are the most complex arguments. Like for flags, the position in a commandcall for a list usage is not important.

Valid Lists are:

Value

Values are straight forward arguments. You simple pass them to your command. Instead of a flag or a list, the position is important.

Valid values are:

First value has the content "value one", second value has the content "value two".

First value has the content "value two", second value has the content "value one".

Short Name and Long Name Notation

Flag and list arguments supporting short name ("-f") and long name ("--foo") notation. A short name is indicated by a single "-" while a long name is indicated by a double "-". The handling and the support of them is domain specific (and also a matter of tast). To merge the usage and the content for lists is not part of this component.

Why no Validation?

Validation is a complex topic. That's why I decided to not put it into the domain of this component.
It would complicate the code itself. I would have created a universal validation interface that would slow down the usage of this component. Furthermore, you would have to learn a validation expression language or would have need to write code that fits my validation interface but not your "way of coding".

At the end, what is validation all about?

To sum it up, validation is domain specific for the validation itself and the error handling. That's why I have decided to not support it deeply. The component supports your validation implementation with the methods "hasLists()", "hasList($name)" etc.

Since I won't write "never say never", if you have a smart idea or way to easy up validation, I'm open for an question or a pull request.

What about Optional Arguments?

Optional arguments underlying the same problems as validation. It is not that easy to implement in an elegant way. It is very special/domain specific (e.g. an argument is optional if flag "--xyz" is used, otherwise mandatory). Your code has to take care if an argument is passed or not anyways. Using the available "has..."-methods should be sufficient and generic enough.

API

API is available at bazzline.net.

Other Great Components

Final Words

Star it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it :-D.


All versions of php_component_cli_arguments with dependencies

PHP Build Version
Package Version
Requires php Version ~8.0
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 net_bazzline/php_component_cli_arguments contains the following files

Loading the files please wait ....