Skip to content

Latest commit

 

History

History
38 lines (22 loc) · 754 Bytes

README.md

File metadata and controls

38 lines (22 loc) · 754 Bytes

argumentor

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"

    });
    
?>