Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Getopt Php Laravel Package

ulrichsg/getopt-php

Lightweight PHP library for parsing command-line options and arguments (getopt). Define short/long flags, required/optional values, and get a clean result for building CLI tools. No framework dependencies, simple API, supports help/usage output.

View on GitHub
Deep Wiki
Context7
v4.0.4

Changelog:

  • fix nullable parameters (many thanks to @AdamSGit)
  • fix github actions and add tests on php 8.4
v4.0.3

Changelog:

v4.0.2

Changelog:

  • add php 8.0 to compatibility list in composer.json
  • use the latest phpunit versions available for the php version (#175)
v4.0.1

Changelog:

  • fix ArrayAccess signature compatibility in php 8.1 (mixed return value; see #171)
v4.0.0

Changelog:

  • drop support for php 5.x and add support for php 8
  • run tests on php 7.x and php 8 on gitlab-ci
  • add type declarations for parameters
  • add link to github versions in old changelog
  • fix return type declarations
v4.0.0-alpha.1

This release is for testing the new version.

v3.4.0

Version 3.4

This might be the last version 3 version as we might get rid of the php 5.x compatibility.

Changelog:

  • compaitibly to php 7.4 #161 and #162
  • updated phpdoc comments #159
  • allow command names to have spaces #150
v3.3.0

Changelog:

  • allow long options with only one character (solves #143)
  • dropped hhvm tests
  • documentation improvements
v3.3.0-rc.1

Changelog:

  • allow long options with only one character (solves #143)
  • dropped hhvm tests
  • documentation improvements
3.2.2

Changelog

  • accept option arguments starting with a hypen when argument is required
3.2.1

Changelog

  • divide getValue and getDefault in attributes
  • don't use default value to increment optional arguments (solves #134)
3.2.0

Changelog

  • add translation system to translate user errors (solves #108)
  • allow custom validation messages (solves #118)
  • add descriptions to operands (solves #125)
3.2.0-alpha.1

Changelog

  • add translation system to translate user errors (solves #108)
  • allow custom validation messages (solves #118)
  • add descriptions to operands (solves #125)
3.1.3

Changelog:

  • add ext-mbstring requirement (solves #130)
3.1.2

Changelog:

  • allow dashes as breaks in descriptions
  • break at screen width if no space or dash in the description (solves #127)
3.1.1

Changelog:

  • return an empty array for multiple operands (solves #119 and #124)
3.1.0

Changelog:

  • getters for Command, Argument, Option, Operand and GetOpt changed
  • implemented magic getter for easier access to getters
  • removed default templates for help and implemented functionality as methods
3.1.0-alpha.1

This is a pre release for version 3.1. The help is still not adapted and the release has to wait for it.

Changelog:

  • getters for Command, Argument, Option, Operand and GetOpt changed
  • implemented magic getter for easier access to getters
  • removed default templates for help and implemented functionality as methods
3.0.3

Changelog

  • fixed iterator to iterate over empty values (solves #93)
3.0.2

Changelog

  • fixed homepage url in composer.json (thanks to malaire)
3.0.1

Changelog

  • fixed: Operand::required() made the operand multiple on second call (solves #84)
  • added Operand::multiple() for sake of consistence
3.0.0

Many changes have been made. People already using version 2.* will have to change their code on some places. The most important: the class name and the namespace have changed. If you don't want to change everything just change your use-Statement:

// use ulrichsg\Getopt;
use GetOpt\GetOpt as Getopt;

Changelog

Features

  • php 5.3 support dropped (solves #72)
  • moved to neutral namespace GetOpt
  • classname changed to GetOpt
  • second parameter for constructor got array of settings (use GetOpt::SETTING_* constants)
  • argument constants changed to string :*Arg
  • parse options after operands (gnu compatibility; solves #39)
  • added GetOpt::MULTIPLE_ARGUMENT for parameter aggregation (solves #57)
  • implemented Command for kinda routing in console applications (solves #41)
  • implemented Operand for named operands and validation (solves #27)
  • added strict modes for strict operand and parameter matches (default is true for options) (solves #14)
  • added HelpInterface for custom help implementations
  • refactored GetOpt::getHelpText() for better support of other features and customization
  • default help class uses templates

Bugfixes

  • GetOpt::count() returns the wrong value (solves #70)
3.0.0-beta.1

Many changes have been made. People already using version 2.* will have to change their code on some places. The most important: the class name and the namespace have changed. If you don't want to change everything just change your use-Statement:

// use ulrichsg\Getopt;
use GetOpt\GetOpt as Getopt;

Changelog:

Features:

  • php 5.3 support dropped (solves #72)
  • moved to neutral namespace GetOpt
  • classname changed to GetOpt
  • second parameter for constructor got array of settings (use GetOpt::SETTING_* constants)
  • argument constants changed to string :*Arg
  • parse options after operands (gnu compatibility; solves #39)
  • added GetOpt::MULTIPLE_ARGUMENT for parameter aggregation (solves #57)
  • implemented Command for kinda routing in console applications (solves #41)
  • implemented Operand for named operands and validation (solves #27)
  • added strict modes for strict operand and parameter matches (default is true for options) (solves #14)
  • added HelpInterface for custom help implementations
  • refactored GetOpt::getHelpText() for better support of other features and customization
  • default help class uses templates

Bugfixes:

  • GetOpt::count() returns the wrong value (solves #70)
3.0.0-alpha.8

Changelog:

  • fixed return value of GetOpt::getOption() for an option with multiple argument but without default value
  • refactored tests
3.0.0-alpha.7

Major changes to command interface.

  • added fluent interface for constructor
  • removed descriptions from constructor
  • added setters for name, handler, description and shortDescription
3.0.0-alpha.6

Some slightly changes to the API for Command.

  1. You can now use the OptionParser for commands which enables options from string and from array
  2. The OptionParser is completly static now
  3. You can not have different default modes in different GetOpt instances

Because the OptionParser is static now the default mode is a public static property too. All instances from GetOpt and Command use the same default mode. For backward compatibility you can still use the SETTING_DEFAULT_MODE for GetOpt.

3.0.0-alpha.3

Many changes have been made. People already using version 2.* will have to change their code on some places. The most important: the class name and the namespace have changed. If you don't want to change everything just change your use-Statement:

// use ulrichsg\Getopt;
use GetOpt\GetOpt as Getopt;

Changelog:

Features:

  • php 5.3 support dropped (solves #72)
  • moved to neutral namespace GetOpt
  • classname changed to GetOpt
  • second parameter for constructor got array of settings (use GetOpt::SETTING_* constants)
  • argument constants changed to string :*Arg
  • parse options after operands (gnu compatibility; solves #39)
  • added GetOpt::MULTIPLE_ARGUMENT for parameter aggregation (solves #57)
  • implemented Command for kinda routing in console applications (solves #41)
  • implemented Operand for named operands and validation (solves #27)
  • added strict modes for strict operand and parameter matches (default is true for options) (solves #14)
  • added HelpInterface for custom help implementations
  • refactored GetOpt::getHelpText() for better support of other features and customization
  • default help class uses templates

Bugfixes:

  • GetOpt::count() returns the wrong value (solves #70)
2.4.3

Changelog

  • moved documentation to master branch
  • added badges to readme
2.4.2

merged tflori/getopt-php

Changelog:

  • don't show options when there are no options configured
  • allow arguments in quotes (allows single quote in double quote and vise versa)
  • get script name from argv[0] when parsing arguments from array or string
  • add method to set scriptname manually
  • support for php 7.1
2.3.0

Features

  • Optional argument descriptions (courtesy of @sabl0r)

Bugfixes

  • Passing a single hyphen as an option value works now (courtesy of @tistre)
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation