simonepm/argumentor

simple and easy PHP library for passing arguments and options to a PHP command script from command line.

Installs: 25

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/simonepm/argumentor

v1.0 2018-10-28 20:59 UTC

This package is auto-updated.

Last update: 2025-12-29 03:07:05 UTC


README

simple and easy PHP library for passing arguments and options to a PHP script from command line.

Installation

composer require simonepm/argumentor

Usage

php example.php testArgument -o testOption

Example

<?php

    require_once "vendor/autoload.php";

    use Simonepm\Argumentor\Command;
    use Simonepm\Argumentor\Argument;
    use Simonepm\Argumentor\Option;

    $command = new Command();

    $command->RegisterArgument("argument");
    $command->RegisterOption("option", "o");

    $command->Exec(function(Argument $argument, Option $option) {

        echo $argument->Get("argument") . PHP_EOL; // "testArgument\n"

        echo $option->Get("option") . PHP_EOL; // "testOption\n"

    });
    
?>