PHPackages                             jlaso/console-args - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. jlaso/console-args

ActiveLibrary[CLI &amp; Console](/categories/cli)

jlaso/console-args
==================

A wrapper for the argv global

162PHP

Since Nov 14Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jlaso/console-args)[ Packagist](https://packagist.org/packages/jlaso/console-args)[ RSS](/packages/jlaso-console-args/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/bab8a9378ea2f3e2993da248578030b04e1c758e8e9c78f22bdcaa95f8739213/68747470733a2f2f706f7365722e707567782e6f72672f6a6c61736f2f636f6e736f6c652d617267732f762f737461626c652e737667)](https://packagist.org/packages/jlaso/console-args) [![Total Downloads](https://camo.githubusercontent.com/25b5ad72c463ce1ab2a6028c80854f8371e9f30fa2e9395103e8572d09208eb7/68747470733a2f2f706f7365722e707567782e6f72672f6a6c61736f2f636f6e736f6c652d617267732f646f776e6c6f6164732e737667)](https://packagist.org/packages/jlaso/console-args) [![Latest Unstable Version](https://camo.githubusercontent.com/aea4471c36d974a1fac6cd2b0e4ff71d524783c4eeeab03f95f3b7b9a61b8160/68747470733a2f2f706f7365722e707567782e6f72672f6a6c61736f2f636f6e736f6c652d617267732f762f756e737461626c652e737667)](https://packagist.org/packages/jlaso/console-args) [![License](https://camo.githubusercontent.com/b70efbf7c4cded404e702b7efc89c66a281fef1cb6e30d7bc838818e5b485135/68747470733a2f2f706f7365722e707567782e6f72672f6a6c61736f2f636f6e736f6c652d617267732f6c6963656e73652e737667)](https://packagist.org/packages/jlaso/console-args)

console-args
============

[](#console-args)

This is an wrapper for the argv global

The difference between arguments and options are:

- arguments are strings like `--help`
- options are strings like `--file=filename`
- other arguments without `--` are not recognized because the magic of this wrapper is that doesn't matter the order of the arguments/options

Version
-------

[](#version)

1.0.0

Installation
------------

[](#installation)

Add the module by composer.json, adding in require clause:

```
{
    "jlaso/console-args": "1.0.0"
}

```

Sample of use
-------------

[](#sample-of-use)

```
$consoleArgs = new ConsoleArgs($argv, array('help'), array('arg1', 'arg2'));

if($consoleArgs->hasHelp){
    print
