Download the PHP package dlin/getopt without Composer

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

Dlin Getopt Option Parser

1. Overview

PHP Command Line Argument Parser.

When developing a executable command line script in PHP, we are most likely trying to achieve the following:

Dlin\Getopt is designed to free you from writing all these repeated tasks.

2. Installation

With composer, add to your composer.json :

For those who are not using composer:

3. Basic Usage

Example used in the following sections assumes we are working on a command line PHP script named myScript.php

Constructor

The constructor of the Geocoder class takes an optional array of option configurations as the parameter. Please refer to the configuration section for option configuration settings.

or you can set option configuration after creating an instance

Passing option parameters at command line

The option parameters provided at command line must either be in

String with invalid option format will be considered as normal parameter

Option parameter values are the first argument after the option parameter string. It does not matter if a value has leading white space or not. However, value can not contain any white space.

If a value is passed without a matching option parameter (e.g. -h or --help), it will be make available in the script via the '_' property. (see next section)

Getting option values in the script

- Parsable options
- Unparsable options

The '_' (underscore) property contains an array of other unparsable parameters

- Invalid option parameters

Invalid option parameters may lead to unexpected result:

Alias

You can define an option to have alias. e.g. -t with alias -type, -s with alias -size. the option and its alias can be used interchangeably. Alias name dose not need to be longer or shorter than the 'arg' name. And 'arg' name does not need to be of single character.

4. Option configuration

An option config is simple an associate array ( object ).

Fields:

Example:

Note:

5. Showing Usage

By default, when a parameter -h or --help is passed, GetOpt will terminate the current script, and outputs the usage message like the following:

The descriptive text on the right are option's 'help' property. The Usage line can be customised:

6. Advanced Configuration

You can further customize:

  1. How messages are output
  2. How script is terminated
  3. How user input is captured

by providing your own functions to the constructor:

Here is the default implementation of the 3 functions if not provided:

7. License

This library is free. Please refer to the license file in the root directory for detail license info.


All versions of getopt 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 dlin/getopt contains the following files

Loading the files please wait ....