PHPackages                             clue/arguments - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. clue/arguments

ActiveLibrary[CLI &amp; Console](/categories/cli)

clue/arguments
==============

The simple way to split your command line string into an array of command arguments in PHP.

v2.1.0(5y ago)31190.6k↑41.3%7[1 issues](https://github.com/clue/arguments/issues)7MITPHPPHP &gt;=5.3

Since Oct 8Pushed 2y ago4 watchersCompare

[ Source](https://github.com/clue/arguments)[ Packagist](https://packagist.org/packages/clue/arguments)[ Docs](https://github.com/clue/arguments)[ Fund](https://clue.engineering/support)[ GitHub Sponsors](https://github.com/clue)[ RSS](/packages/clue-arguments/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (7)

clue/arguments
==============

[](#cluearguments)

[![CI status](https://github.com/clue/arguments/actions/workflows/ci.yml/badge.svg)](https://github.com/clue/arguments/actions)[![installs on Packagist](https://camo.githubusercontent.com/8d8e3bf2573765f361a5c6ba56c7bc9322722c8b9eef38cdcd8f8a56455c97f0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c75652f617267756d656e74733f636f6c6f723d626c7565266c6162656c3d696e7374616c6c732532306f6e2532305061636b6167697374)](https://packagist.org/packages/clue/arguments)

The simple way to split your command line string into an array of command arguments in PHP.

You want to build an interactive command line interface (CLI) tool in PHP which reads line based user input from STDIN and you now want to break this command line down to its individual command arguments? Then this library is for you!

This is similar to what your bash (or your terminal of choice) does for you when you execute `./example.php "hello world"` which then spawns your script and passes it a single argument. If you only need this during startup, then using your `$argv` may be sufficient. But many other tools may need similar parsing during their runtime.

**Table of contents**

- [Support us](#support-us)
- [Quickstart example](#quickstart-example)
- [Usage](#usage)
    - [split()](#split)
    - [UnclosedQuotesException](#unclosedquotesexception)
- [Install](#install)
- [Tests](#tests)
- [License](#license)
- [More](#more)

Support us
----------

[](#support-us)

We invest a lot of time developing, maintaining and updating our awesome open-source projects. You can help us sustain this high-quality of our work by [becoming a sponsor on GitHub](https://github.com/sponsors/clue). Sponsors get numerous benefits in return, see our [sponsoring page](https://github.com/sponsors/clue)for details.

Let's take these projects to the next level together! 🚀

### Quickstart example

[](#quickstart-example)

The following example code demonstrates how this library can be used to build a very simple interactive command line interface (CLI) tool that accepts a command line from user input (via `STDIN`) and then executes some very simple demo commands:

```
