PHPackages                             alphayax/get\_opt - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. alphayax/get\_opt

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alphayax/get\_opt
=================

Utility class for manage scripts arguments

3.1.0(8y ago)28.7kLGPL-2.1PHP

Since Jun 18Pushed 8y ago1 watchersCompare

[ Source](https://github.com/alphayax/get_opt)[ Packagist](https://packagist.org/packages/alphayax/get_opt)[ RSS](/packages/alphayax-get-opt/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (13)Used By (0)

Get Opt
=======

[](#get-opt)

A library to manage scripts arguments

[![Latest Stable Version](https://camo.githubusercontent.com/ec13494febb73e818dcf0534a423856e87402433995e3dbdc0e821fe1f8a826b/68747470733a2f2f706f7365722e707567782e6f72672f616c7068617961782f6765745f6f70742f762f737461626c65)](https://packagist.org/packages/alphayax/get_opt)[![Latest Unstable Version](https://camo.githubusercontent.com/c9a0a48bc23935108cbd37614f9e03ecdf2dea72f6197b3651be81562b8fff50/68747470733a2f2f706f7365722e707567782e6f72672f616c7068617961782f6765745f6f70742f762f756e737461626c65)](https://packagist.org/packages/alphayax/get_opt)[![pakagist](https://camo.githubusercontent.com/9dbf153bbc409a9433d07950e9bfad50bc572da13ba95a80f38f9aa72c795281/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c7068617961782f6765745f6f70742e737667)](https://packagist.org/packages/alphayax/get_opt)

[![Travis](https://camo.githubusercontent.com/ee8a8ea3b85b51950625364d5dfb4fc240e108b246ffd63a62b9339c96cb3e71/68747470733a2f2f7472617669732d63692e6f72672f616c7068617961782f6765745f6f70742e737667)](https://travis-ci.org/alphayax/get_opt)[![Coverage Status](https://camo.githubusercontent.com/244e6b927b47d9ada00889987a4f19d3761a9f8eb766eeda1184d963a6dabdcd/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f3762636332386265386564663431643862393238353431383139376430393366)](https://www.codacy.com/app/alphayax/get_opt?utm_source=github.com&utm_medium=referral&utm_content=alphayax/get_opt&utm_campaign=Badge_Coverage)[![Codacy Badge](https://camo.githubusercontent.com/02aa01951d576f28c0bc2b2a17d9e9ca49c288f9051f53aa844f90665b26a4d2/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3762636332386265386564663431643862393238353431383139376430393366)](https://www.codacy.com/app/alphayax/get_opt?utm_source=github.com&utm_medium=referral&utm_content=alphayax/get_opt&utm_campaign=Badge_Grade)

[![License](https://camo.githubusercontent.com/dcd977377b5600ea27df2e28a697f30b033601604a32d32cb4bfae4ab1ce850e/68747470733a2f2f706f7365722e707567782e6f72672f616c7068617961782f6765745f6f70742f6c6963656e7365)](https://packagist.org/packages/alphayax/get_opt)[![Total Downloads](https://camo.githubusercontent.com/af0431c60decc4b907cc1e27074acd0629dde5692d3285eaf2d06c36d4ce7944/68747470733a2f2f706f7365722e707567782e6f72672f616c7068617961782f6765745f6f70742f646f776e6c6f616473)](https://packagist.org/packages/alphayax/get_opt)

Features
--------

[](#features)

- Singleton pattern
- Auto generate help
- Manage short and long option (-a --abc)
- Manage values and multiple values (-v /toto -v /tutu)
- Manage required options

Examples
--------

[](#examples)

### Check if a parameter (specified via a letter or a name) is set

[](#check-if-a-parameter-specified-via-a-letter-or-a-name-is-set)

```
$Args = \alphayax\utils\cli\GetOpt::getInstance();
$Args->setDescription('This script is a tiny example to show library features');
$verboseOption = $Args->addOpt('v', 'verbose', 'Verbose Mode');

$Args->parse();

$isVerboseMode = $verboseOption->isPresent();
```

### Get the value of the --file option

[](#get-the-value-of-the---file-option)

```
$Args = \alphayax\utils\cli\GetOpt::getInstance();
$Args->setDescription('This script is a tiny example to show library features');
$fileOption = $Args->addOpt('f', 'file', 'File name', true);

$Args->parse();

// Check if file option is specified (via -f or --file)
if( $fileOption->isPresent()){
    $fileName = $fileOption->getValue();
}
```

Auto-generated Help
-------------------

[](#auto-generated-help)

Example of help output (if the -h or --help flag is specified) :

```
   Description
   	This script is a tiny example to show library features

   Usage
   	/usr/bin/php a.php [OPTIONS]

   Options
	-d        	              	Debug mode
	          	--dry-run     	Dry Run mode
	          	--file 	Specify the file name
	-h        	--help        	Display help
	-n 	              	[REQUIRED] Number of lines
	-v        	--verbose     	Verbose Mode

```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~61 days

Recently: every ~37 days

Total

12

Last Release

2943d ago

Major Versions

0.0.2 → 1.0.02016-06-18

1.0.2 → 2.0.02017-11-19

2.1.1 → 3.0.02017-11-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/864f043bb7801d8e12b35db8aa877481ce4c752fe96b9a53e3c49447b68e6b34?d=identicon)[alphayax](/maintainers/alphayax)

---

Top Contributors

[![alphayax](https://avatars.githubusercontent.com/u/7924417?v=4)](https://github.com/alphayax "alphayax (22 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alphayax-get-opt/health.svg)

```
[![Health](https://phpackages.com/badges/alphayax-get-opt/health.svg)](https://phpackages.com/packages/alphayax-get-opt)
```

###  Alternatives

[rupadana/filament-slider

Slide into Precision – Customizable Control at Your Fingertips.

1221.3k](/packages/rupadana-filament-slider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
