Download the PHP package donatj/flags without Composer

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

Flags

Latest Stable Version Total Downloads License Build Status

Flags is an argument parser inspired by the Go-lang Flag package, taking its methodology but attaching a GNU-style flag parser.


Flags supports the following style of parameters:

Long-Flags
--key=value / --key value

Short-Flags
-v

GNU Style Multi-Short-Flags
-Xasd

Multiple of the Same Short-Flag
-vvv

As well as the  --  operator for absolute separation of arguments from options.

Requirements

Installing

Install the latest version with:

Example

Here is a simple example script:

The by-reference = & allows the value to be updated from the default to the argument value once the parse() method has been triggered. This is inspired by the Go Flag packages use of pointers

Documentation

Class: \donatj\Flags

Method: Flags->__construct

Flags constructor.

Parameters:

Method: Flags->arg

Returns the n'th command-line argument. arg(0) is the first remaining argument after flags have been processed.

Parameters:
Returns:

Method: Flags->args

Returns the non-flag command-line arguments.

Returns:

Method: Flags->shorts

Returns an array of short-flag call-counts indexed by character

-v would set the 'v' index to 1, whereas -vvv will set the 'v' index to 3

Returns:

Method: Flags->longs

Returns an array of long-flag values indexed by flag name

Returns:

Method: Flags->short

Defines a short-flag of specified name, and usage string.

The return value is a reference to an integer variable that stores the number of times the short-flag was called.

This means the value of the reference for v would be the following.

-v => 1  
-vvv => 3
Parameters:
Returns:

Method: Flags->bool

Defines a bool long-flag of specified name, default value, and usage string.

The return value is a reference to a variable that stores the value of the flag.

Examples
Truth-y
 --mybool=[true|t|1]  
 --mybool [true|t|1]  
 --mybool  
False-y
 --mybool=[false|f|0]  
 --mybool [false|f|0]  
   [not calling --mybool and having the default false]
Parameters:
Returns:

Method: Flags->float

Defines a float long-flag of specified name, default value, and usage string.

The return value is a reference to a variable that stores the value of the flag.

Examples
--myfloat=1.1  
--myfloat 1.1
Parameters:
Returns:

Method: Flags->int

Defines an integer long-flag of specified name, default value, and usage string.

The return value is a reference to a variable that stores the value of the flag.

Note: Float values trigger an error, rather than casting.

Examples
--myinteger=1  
--myinteger 1
Parameters:
Returns:

Method: Flags->uint

Defines a unsigned integer long-flag of specified name, default value, and usage string.

The return value is a reference to a variable that stores the value of the flag.

Note: Negative values trigger an error, rather than casting.

Examples
--myinteger=1  
--myinteger 1
Parameters:
Returns:

Method: Flags->string

Defines a string long-flag of specified name, default value, and usage string.

The return value is a reference to a variable that stores the value of the flag.

Examples

--mystring=vermouth  
--mystring="blind jazz singers"  
--mystring vermouth  
--mystring "blind jazz singers"
Parameters:
Returns:

Method: Flags->getDefaults

Returns the default values of all defined command-line flags as a formatted string.

Example
Returns:

Method: Flags->parse

Parses flag definitions from the argument list, which should include the command name.

Must be called after all flags are defined and before flags are accessed by the program.

Will throw exceptions on Missing Require Flags, Unknown Flags or Incorrect Flag Types

Parameters:

Method: Flags->parsed

Returns true if the command-line flags have been parsed.

Returns:

All versions of flags with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 donatj/flags contains the following files

Loading the files please wait ....