PHPackages                             donatj/flags - 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. donatj/flags

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

donatj/flags
============

GNU-style PHP command line argument parser

v1.6.0(1y ago)19152.2k↑39.9%3[4 issues](https://github.com/donatj/Flags/issues)[1 PRs](https://github.com/donatj/Flags/pulls)6MITPHPPHP &gt;=7.1.0CI passing

Since Oct 4Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/donatj/Flags)[ Packagist](https://packagist.org/packages/donatj/flags)[ Fund](https://www.paypal.me/donatj/15)[ GitHub Sponsors](https://github.com/donatj)[ RSS](/packages/donatj-flags/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (12)Used By (6)

Flags
=====

[](#flags)

[![Latest Stable Version](https://camo.githubusercontent.com/32cbdbd5b32f01e261292bbafce58c1d50b4f06d7526a322afc25417048fd103/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f666c6167732f76657273696f6e)](https://packagist.org/packages/donatj/flags)[![Total Downloads](https://camo.githubusercontent.com/c9c41dfacd7a8f96209a1bb8d8ccef8c7cde50cb111c6791c8f37f7055ea3e76/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f666c6167732f646f776e6c6f616473)](https://packagist.org/packages/donatj/flags)[![License](https://camo.githubusercontent.com/5208db6d15d8a5d53f9e5e625483ab248881673277a88b6f2e137d0d1ce88e1f/68747470733a2f2f706f7365722e707567782e6f72672f646f6e61746a2f666c6167732f6c6963656e7365)](https://packagist.org/packages/donatj/flags)[![ci.yml](https://github.com/donatj/Flags/actions/workflows/ci.yml/badge.svg)](https://github.com/donatj/Flags/actions/workflows/ci.yml)

Flags is an argument parser inspired by the Go-lang [Flag](http://golang.org/pkg/flag/#Parsed) 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
------------

[](#requirements)

- **php**: &gt;=7.1.0

Installing
----------

[](#installing)

Install the latest version with:

```
composer require 'donatj/flags'
```

Example
-------

[](#example)

Here is a simple example script:

```
