{"id":18127804,"url":"https://github.com/lelutin/php-optparse","last_synced_at":"2025-04-15T09:34:20.335Z","repository":{"id":982073,"uuid":"784356","full_name":"lelutin/php-optparse","owner":"lelutin","description":"PHP port of Python's optparse module","archived":false,"fork":false,"pushed_at":"2024-02-04T21:16:23.000Z","size":29,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T18:51:50.346Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lelutin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-07-19T15:31:58.000Z","updated_at":"2024-02-04T21:16:17.000Z","dependencies_parsed_at":"2023-12-15T03:39:06.659Z","dependency_job_id":"be897234-df16-4b73-9485-9f496458ab32","html_url":"https://github.com/lelutin/php-optparse","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelutin%2Fphp-optparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelutin%2Fphp-optparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelutin%2Fphp-optparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lelutin%2Fphp-optparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lelutin","download_url":"https://codeload.github.com/lelutin/php-optparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249042974,"owners_count":21203389,"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","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":[],"created_at":"2024-11-01T09:42:11.230Z","updated_at":"2025-04-15T09:34:20.314Z","avatar_url":"https://github.com/lelutin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHPOptparse -- A command-line option parser for PHP\n\nPHPOptparse is a PHP port of Python's optparse module. Its interface tries to\nbe as similar as possible to that of its Python counterpart.\n\nDISCLAIMER\n==========\n\nI personally won't be using this module anymore. I've just ported another\nmodule that achieves the same things as this one, but that is _a lot_ simpler\n(about 1/3 the amount of lines of code) and that makes code an awsome lot\ncleaner.  Check out this other module:\n\nhttps://github.com/lelutin/php-options\n\nHowever, if others continue to fix bugs or implement cool things, I'll still be\nmerging patches to this code so that it's not completely dead.\n\nHow to use\n==========\n\nSimply drop the optparse.php file in your project directory and include() it.\nThen, create an OptionParser object and add options with the add\\_option()\nmethod. When all options are set up, parse the options with the parse\\_args()\nmethod. The object returned from parse\\_args will contain all the values from\nthe command line as attributes corresponding to names given to the \"dest\"\nparameter to add\\_option().\n\nExample:\n\n    // called with: ./my_program -b 4\n\n    $option_parser = new OptionParser(array(\"version\"=\u003e\"meuh 1.2.3\", \"description\" =\u003e \"lalla\", \"epilog\"=\u003e\"patate\"));\n    $option_parser-\u003eadd_option(array(\n        \"-b\", \"--booh\",\n        \"dest\" =\u003e \"gah\",\n        \"metavar\" =\u003e \"\u003cthe thing\u003e\",\n        \"type\" =\u003e \"int\"\n    ));\n    $options = $option_parser-\u003eparse_args($argv);\n\n    // here $options-\u003egah contains 4\n\nRunning the tests\n=================\n\nThe 't' directory contains unit tests for classes contained in the PHPOptparse\nlibrary. To run the tests, use phpunit in the following manner:\n\n    phpunit OptionTest\n\nLicense\n=======\n\nThe PHPOptparse library is licensed under the GNU GPLv2. The full license text\nshould be shipped with the code in a file named LICENSE. If not, you can find\nthe full text online at the following URL:\n\nhttp://www.gnu.org/licenses/gpl-2.0.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelutin%2Fphp-optparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flelutin%2Fphp-optparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flelutin%2Fphp-optparse/lists"}