2017 © Pedro Peláez
 

library argparser

ArgParser component for Palmtree PHP

image

palmtree/argparser

ArgParser component for Palmtree PHP

  • Saturday, June 24, 2017
  • by palmtree
  • Repository
  • 1 Watchers
  • 0 Stars
  • 175 Installations
  • PHP
  • 7 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 3 % Grown

The README.md

Palmtree ArgParser

License, (*1)

Parse an array of arguments and call matching setters and/or merge with default arguments., (*2)

Requirements

  • PHP >= 7.1

Installation

Use composer to add the package to your dependencies:, (*3)

composer require palmtree/argparser

Usage

<?php

use Palmtree\ArgParser\ArgParser;

class SomeClass {
    public static $defaultArgs = [
        'force' => false,
    ];

    private $name;
    private $args = [];

    public function __construct($args = []) {
        $parser = new ArgParser($args);

        $parser->parseSetters($this);
        $this->args = $parser->resolveOptions(static::$defaultArgs);
    }

    public function setName($name) {
        $this->name = $name;
    }
}
<?php
// Calls $obj->setName('Andy') and sets the force arg to true
$obj = new SomeClass([
    'name' => 'Andy',
    'force' => true,
]);

License

Released under the MIT license, (*4)

The Versions

24/06 2017

dev-master

9999999-dev

ArgParser component for Palmtree PHP

  Sources   Download

MIT

The Requires

 

18/06 2017

v1.2.0

1.2.0.0

ArgParser component for Palmtree PHP

  Sources   Download

MIT

The Requires

 

06/04 2017

v1.1.1

1.1.1.0

ArgParser component for Palmtree PHP

  Sources   Download

MIT

The Requires

 

22/03 2017

v1.1.0

1.1.0.0

ArgParser component for Palmtree PHP

  Sources   Download

MIT

The Requires

 

20/01 2017

dev-dev

dev-dev

ArgParser component for Palmtree PHP

  Sources   Download

MIT

by andyexeter

25/10 2016

1.0.0

1.0.0.0

ArgParser component for Palmtree PHP

  Sources   Download

MIT

by andyexeter