PHPackages                             fostam/getopts - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. fostam/getopts

ActiveLibrary[CLI &amp; Console](/categories/cli)

fostam/getopts
==============

Flexible PHP command line argument parser with automated help message generation and validation support

v2.0.2(11mo ago)825.1k↓35.7%21MITPHPPHP ^8.2

Since Mar 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/fostam/php-getopts)[ Packagist](https://packagist.org/packages/fostam/getopts)[ RSS](/packages/fostam-getopts/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (1)

fostam/getopts
==============

[](#fostamgetopts)

Flexible PHP command line argument parser with automated help message generation and validation support.

Features
--------

[](#features)

- Flexible and intuitive configuration
- Supports long/short options, option arguments, defaults, incrementable/negatable options etc.
- Non-option argument handling
- Automated usage error handling and help text generation
- Option / argument validation

Install
-------

[](#install)

The easiest way to install GetOpts is by using [composer](https://getcomposer.org/):

```
$> composer require fostam/getopts

```

Usage
-----

[](#usage)

```
