PHPackages                             abstractcli/abstractcli - 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. abstractcli/abstractcli

Abandoned → [joetjen/abstractcli](/?search=joetjen%2Fabstractcli)Library[CLI &amp; Console](/categories/cli)

abstractcli/abstractcli
=======================

Abstract base class for command line parsing

0.1.0(2w ago)131MITPHPPHP ^7.4 || ^8.0

Since Feb 25Pushed 2w agoCompare

[ Source](https://github.com/joetjen/php-abstractcli)[ Packagist](https://packagist.org/packages/abstractcli/abstractcli)[ Docs](http://github.com/joetjen/php-abstractcli)[ RSS](/packages/abstractcli-abstractcli/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (6)Used By (0)

AbstractCLI
===========

[](#abstractcli)

[](https://packagist.org/packages/joetjen/abstractcli)[](https://github.com/joetjen/php-abstractcli/blob/master/LICENSE)

A small, dependency-free abstract base class for building command line PHP scripts: define your options and arguments declaratively, and `AbstractCLI` takes care of parsing `$argv`, validating input, and printing `--help`/`--version` output for you.

It ships with three built-in options out of the box:

- `-h`, `--help` - print usage and exit
- `-v`, `--verbose` - a boolean switch, off by default
- `-V`, `--version` - print the program name/version and exit

Documentation
-------------

[](#documentation)

This README covers requirements, installation and a complete quick-start example. For everything else:

- [QUICKSTART.md](https://github.com/joetjen/php-abstractcli/blob/master/QUICKSTART.md) - the fastest path to a working script.
- [TUTORIAL.md](https://github.com/joetjen/php-abstractcli/blob/master/TUTORIAL.md) - a guided, step-by-step walkthrough that builds up a realistic command feature by feature, verifying its output at every step.
- [CHEATSHEET.md](https://github.com/joetjen/php-abstractcli/blob/master/CHEATSHEET.md) - a condensed reference for the full API, plus a table of behaviors that are easy to get wrong.
- [EXAMPLES.md](https://github.com/joetjen/php-abstractcli/blob/master/EXAMPLES.md) - short, standalone, copy-pasteable scripts for common cases.
- [CHANGELOG.md](https://github.com/joetjen/php-abstractcli/blob/master/CHANGELOG.md) - notable changes, release by release.
- [CONTRIBUTION.md](https://github.com/joetjen/php-abstractcli/blob/master/CONTRIBUTION.md) - how to set up a dev environment, run the tests, and what a good pull request looks like.
- [LICENSE](https://github.com/joetjen/php-abstractcli/blob/master/LICENSE) - MIT.

Requirements
------------

[](#requirements)

- PHP 7.4 or 8.0+ (tested against PHP 8.4)

Installation
------------

[](#installation)

```
composer require joetjen/abstractcli
```

Quick start
-----------

[](#quick-start)

```
