pangodream/php-simpcli

A simple PHP cli arguments parser

Maintainers

Package info

github.com/pangodream/php-simpcli

pkg:composer/pangodream/php-simpcli

Statistics

Installs: 17

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

dev-master 2018-11-03 06:39 UTC

This package is auto-updated.

Last update: 2026-03-29 00:42:21 UTC


README

A simple PHP cli arguments parser

Installation

composer require pangodream/php-simpcli

Usage:

require_once __DIR__.'/../vendor/autoload.php';

use PhpSimpcli\CliParser;

$sp = new CliParser();

var_dump($sp->get('myOption'));

From the cli console:

php test.php -otherOption 

["found"] => bool(false)
["value"] => NULL
["type"]  => NULL

php test.php -myOption 

["found"] => bool(true)
["value"] => NULL
["type"]  => "missing"

php test.php -myOption Hello

["found"] => bool(true)
["value"] => "Hello"
["type"]  => "single"

php test.php -myOption Hello World

["found"] => bool(true)
["value"] => array([0] => "Hello, [1] => "World")
["type"]  => multi

php test.php -myOption Hello "Wonderful World"

["found"] => bool(true)
["value"] => array([0] => "Hello, [1] => "Wonderful World")
["type"]  => multi