The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages

Getting Started



Terminal Objects


CLImate gives you the ability to easily define and parse arguments passed to your script.

Defining Arguments

When defining arguments, there are several options at your disposal:

These options are not required, you may choose any that are applicable to your definition.

Argument definitions are always passed as an associative array:

    'user' => [
        'prefix'       => 'u',
        'longPrefix'   => 'user',
        'description'  => 'Username',
        'defaultValue' => 'me_myself_i',
    'password' => [
        'prefix'      => 'p',
        'longPrefix'  => 'password',
        'description' => 'Password',
        'required'    => true,
    'iterations' => [
        'prefix'      => 'i',
        'longPrefix'  => 'iterations',
        'description' => 'Number of iterations',
        'castTo'      => 'int',
    'verbose' => [
        'prefix'      => 'v',
        'longPrefix'  => 'verbose',
        'description' => 'Verbose output',
        'noValue'     => true,
    'help' => [
        'longPrefix'  => 'help',
        'description' => 'Prints a usage statement',
        'noValue'     => true,
    'path' => [
        'description' => 'The path to push',

Parsing and Retrieving Values

Parsing the passed arguments and retrieving their values is very simple.

You must first parse the arguments:


Please note that if you have defined required arguments and they are not passed in, the parse method will throw an Exception

Then you may retrieve the value of any of your arguments by the key associated with their definition:


To simply check if an argument was was passed at all, you can use the defined method:


Adding a Description

Sometimes it’s helpful to add a short description of the script to help a user out. Easy enough:

$climate->description('My CLI Script');

This comes in handy when printing…

Usage Statements

Printing a formatted usage statement is easy:


would result in:

My CLI Script

Usage: functional/args.php [--help] [-i iterations, --iterations iterations] [-p password, --password password] [-u user, --user user (default: me_myself_i)] [-v, --verbose] [path]

Required Arguments:
    -p password, --password password

Optional Arguments:
        Prints a usage statement
    -i iterations, --iterations iterations
        Number of iterations
    -u user, --user user (default: me_myself_i)
    -v, --verbose
        Verbose output