{"id":19951305,"url":"https://github.com/palmtreephp/argparser","last_synced_at":"2025-07-28T23:36:23.901Z","repository":{"id":57035217,"uuid":"71888517","full_name":"palmtreephp/argparser","owner":"palmtreephp","description":":palm_tree: Parse an array of arguments to call matching setter methods and/or merge with some defaults","archived":false,"fork":false,"pushed_at":"2021-03-22T18:04:05.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-26T19:05:00.503Z","etag":null,"topics":["argparse","argument-parser","defaults"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/palmtreephp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-25T11:04:09.000Z","updated_at":"2021-03-22T18:04:07.000Z","dependencies_parsed_at":"2022-08-23T20:50:47.750Z","dependency_job_id":null,"html_url":"https://github.com/palmtreephp/argparser","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/palmtreephp/argparser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fargparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fargparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fargparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fargparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palmtreephp","download_url":"https://codeload.github.com/palmtreephp/argparser/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palmtreephp%2Fargparser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604502,"owners_count":24114539,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argparse","argument-parser","defaults"],"created_at":"2024-11-13T01:07:29.535Z","updated_at":"2025-07-28T23:36:23.868Z","avatar_url":"https://github.com/palmtreephp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Palmtree ArgParser\n\n[![License](http://img.shields.io/packagist/l/palmtree/argparser.svg)](LICENSE)\n\nParse an array of arguments and call matching setters and/or merge with default arguments.\n\n## Requirements\n* PHP \u003e= 7.1\n\n## Installation\n\nUse composer to add the package to your dependencies:\n```bash\ncomposer require palmtree/argparser\n```\n\n## Usage\n\n```php\n\u003c?php\n\nuse Palmtree\\ArgParser\\ArgParser;\n\nclass SomeClass {\n    public static $defaultArgs = [\n        'force' =\u003e false,\n    ];\n\n    private $name;\n    private $args = [];\n\n    public function __construct($args = []) {\n        $parser = new ArgParser($args);\n\n        $parser-\u003eparseSetters($this);\n        $this-\u003eargs = $parser-\u003eresolveOptions(static::$defaultArgs);\n    }\n\n    public function setName($name) {\n        $this-\u003ename = $name;\n    }\n}\n```\n```php\n\u003c?php\n// Calls $obj-\u003esetName('Andy') and sets the force arg to true\n$obj = new SomeClass([\n    'name' =\u003e 'Andy',\n    'force' =\u003e true,\n]);\n```\n\n## License\n\nReleased under the [MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fargparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalmtreephp%2Fargparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalmtreephp%2Fargparser/lists"}