sebastianbergmann

sebastianbergmann/cli-parser

PHP BSD-3-Clause Dev Tools

Library for parsing CLI options

1.2k stars
7 forks
active
GitHub

1.2k

Stars

7

Forks

1

Open issues

4

Contributors

4.2.1 17 May 2026

AI Analysis

A lightweight PHP library for parsing command-line arguments from $_SERVER['argv'], extracted from PHPUnit's internal utilities. It serves developers building CLI tools in PHP who need robust argument parsing without heavy dependencies. Best suited for PHP framework authors and CLI tool developers; not intended for web application request parsing.

Dev Tools Library Discovery value: 4/10
Documentation 7/10
Activity 10/10
Community 6/10
Code quality 8/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

cli-parsing php-utility argument-handling phpunit-ecosystem lightweight-library
Actively maintained Niche/specialized use case Beginner friendly Production ready
Deep Analysis · Based on README and public signals
17h ago

Lightweight PHP CLI argument parser extracted from PHPUnit, serving as a focused utility for testing frameworks

sebastian/cli-parser is a PHP library that extracts and standardizes command-line argument parsing logic originally embedded in PHPUnit. It provides a minimal, purpose-built solution for parsing $_SERVER['argv'] with no external dependencies. Adoption appears limited to testing frameworks and developer tools within the PHP ecosystem, particularly PHPUnit-adjacent projects. The project solves a real but narrow problem: cleanly decoupling CLI parsing from test runner logic.

Origin

Created in August 2020 by Sebastian Bergmann, extracted from PHPUnit's codebase to promote reusability and separation of concerns. This reflects a common pattern in mature projects: isolating well-tested utilities into standalone libraries to reduce coupling and enable broader use.

Growth

The project shows modest, stable adoption (~1,208 stars, 7 forks) with minimal star growth in recent periods. The consistent activity (last push 2026-07-08) suggests maintenance rather than expansion. Growth appears driven by inclusion as a dependency in PHPUnit and related tools, rather than organic developer discovery or competitive differentiation.

In production

Adoption not verified beyond reasonable inference that PHPUnit itself depends on this library (as it was extracted from PHPUnit). No public documentation of downstream users, production deployments, or adoption metrics. The presence on Packagist and use in CI suggests real usage, but scale and breadth are undisclosed.

Code analysis
Architecture

Based on README, the library appears to be a single-purpose extraction: a stateless parser for $_SERVER['argv']. Likely organized as a lean utility without configuration frameworks or plugin systems. The extraction narrative suggests clean API boundaries, though specific design patterns are not documented in the README.

Tests

README displays a codecov badge linked to the repository, indicating test coverage is measured and tracked, but the specific percentage or targets are not stated in the provided excerpt. The presence of CI/CD badges suggests continuous testing is enforced.

Maintenance

Active maintenance confirmed: last push on 2026-07-08 (current date is 2026-07-09), indicating the project is being monitored and updated. CI workflow is present and functional. No evidence of stagnation; the slow star accumulation reflects narrow scope rather than abandonment. Issue and PR activity not disclosed in metadata.

Honest verdict

ADOPT IF: you are building a testing framework, developer tool, or CLI utility in PHP and want a lightweight, zero-dependency argument parser that follows PHPUnit's proven patterns. AVOID IF: you need a feature-rich CLI framework (use Symfony Console instead), or if you require extensive community support and third-party integrations. MONITOR IF: you depend on PHPUnit and want to understand its internal CLI dependencies, or if you're considering extracting similar utilities from your own mature projects.

Independent dimensions

Mainstream potential

2/10

Technical importance

5/10

Adoption evidence

3/10

Risks
  • Narrow scope and limited adoption mean fewer community examples and third-party integrations compared to larger frameworks.
  • Single-author maintenance (Bergmann) creates key-person risk, though his track record with PHPUnit suggests reliability.
  • No documented API stability promise or semantic versioning policy stated in README; breaking changes across minor versions possible.
  • Adoption appears primarily internal to PHPUnit ecosystem; untested in diverse production environments outside testing tools.
  • Limited discoverability: developers solving CLI parsing problems may not find this library if they don't know to look within PHPUnit's ecosystem.
Prediction

This project will remain a stable, slowly-growing utility library with enduring use within PHPUnit and related testing tools. Unlikely to achieve mainstream adoption across general PHP CLI development, but will maintain its niche as long as PHPUnit remains the dominant testing framework. Incremental maintenance expected; no major feature expansion anticipated given the scope.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

PHP
100%

Information

Language
PHP
License
BSD-3-Clause
Last updated
2d ago
Created
72mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Open pull requests

No open pull requests.

Similar repos

sebastianbergmann

sebastianbergmann/environment

This PHP library provides utilities for detecting and handling runtime-specific...

6.8k PHP Dev Tools
minicli

minicli/minicli

Minicli is a minimal, dependency-free PHP framework for building command-line...

1.1k PHP Dev Tools
nikic

nikic/PHP-Parser

PHP Parser is a mature PHP parser written in PHP that converts PHP source code...

17.4k PHP Dev Tools
CLIUtils

CLIUtils/CLI11

CLI11 is a header-only C++ command line parser for C++11 and beyond that...

4.4k C++ Dev Tools
sebastianbergmann

sebastianbergmann/php-code-coverage

php-code-coverage is a specialized PHP library for collecting, processing, and...

8.9k PHP Dev Tools
vs. alternatives
Symfony Console Input

Symfony's Console component provides comprehensive CLI argument parsing with features like commands, options, and interactive prompts. sebastian/cli-parser is far more minimal and dependency-free, suitable for tools that need only argument parsing without a full framework.

Getopt PHP

A third-party CLI parsing library. sebastian/cli-parser is authored by a maintainer with higher visibility in the PHP testing ecosystem and requires no external dependencies, but Getopt offers more configuration flexibility.

PHP built-in getopt()

Native PHP function with limited feature set. sebastian/cli-parser likely provides better abstractions and error handling, but adds a dependency that built-in functions avoid.

Commando

Another option-parsing library with a different API philosophy. Less well-maintained than sebastian/cli-parser based on visibility and author reputation.