# OptsLib A basic Options parser and command-line arguments handling a library for PHP. ## Table of Contents * [OptsLib](#optslib) * [Table of Contents](#table-of-contents) * [Installation](#installation) * [Compiling from source](#compiling-from-source) * [Testing](#testing) * [Usage](#usage) * [parseArgument()](#parseargument) * [getArguments()](#getarguments) * [Additional functionality](#additional-functionality) * [getRegex()](#getregex) * [setRegex()](#setregex) * [Changelog](#changelog) * [License](#license) * [Logo](#logo) * [Contributing](#contributing) ## Installation The library can be installed using ncc: ```bash # n64 ncc package install -p "nosial/libs.opts=latest@n64" # github ncc package install -p "nosial/libs.opts=latest@github" ``` or by adding the following to your project.json file under the `build.dependencies` section: ```json { "name": "net.nosial.optslib", "version": "latest", "source_type": "remote", "source": "nosial/libs.opts=latest@n64" } ``` If you don't have the n64 source configured you can add it by running the following command: ```bash ncc repository add --name n64 --type gitlab --host git.n64.cc ``` ## Compiling from source The library can be compiled from source using ncc: ```bash ncc build --config release ``` or by running the following command: ```bash make release ``` ## Testing The library can be tested using PhpUnit with the `phpunit.xml` file that is already included in the repository. This requires that you have PhpUnit installed & the library has been compiled and installed on the local system. ```bash phpunit ``` ## Usage The usage of this library is very simple, there are two functions that you can use to parse options. ### parseArgument() Can be used to parse a single argument string/array, this is useful for parsing command line arguments. The second argument is the maximum number of arguments that can be parsed, this is to prevent infinite loops. ```php