Skip to content

Pass arguments and options easily from command line to PHP scripts. Featured on Composer Packagist.

License

Notifications You must be signed in to change notification settings

simonepm/argumentor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"

    });
    
?>

About

Pass arguments and options easily from command line to PHP scripts. Featured on Composer Packagist.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages