sebastian/cli-parser
sebastian/cli-parser is a lightweight PHP library for parsing $_SERVER['argv'], extracted from PHPUnit. It gives command-line tools a simple way to read and validate arguments and options without a full CLI framework.
$_SERVER['argv'] into structured options without adopting Symfony Console. It does not support a build-vs-buy decision for anything inside Artisan, where the answer is already "use what Laravel ships."argv parsing. The strongest roadmap case is consolidation: replacing ad-hoc argv/getopt() handling in legacy scripts with a small, tested, MIT/BSD-licensed dependency extracted from PHPUnit. That is a low-effort reliability win with a defensible "proven in production at scale" argument.--help generation, subcommands, interactive prompts, argument validation, or option dependency rules. Teams that need those should plan for Symfony Console or Laravel Zero, and this evaluation should be recorded as "explicitly out of scope" so the gap isn't rediscovered later.Adopt when:
argv handling and want a maintained, tested implementation rather than in-house code.Look elsewhere when:
--help, subcommands, array options, interactive prompts, or typed validation belongs on Symfony Console or Laravel Zero.For executives: This is a small, low-risk utility, not a platform bet. It lets us clean up one-off internal scripts — the kind that run migrations or shuffle data — with a parser that has effectively been in production inside PHPUnit for years, without pulling a full CLI framework into places it doesn't belong. The upside is modest and concrete: fewer fragile custom scripts, faster delivery of internal tooling, negligible dependency cost. The trade-off is equally concrete: it deliberately lacks the conveniences of a real CLI framework, so we will not use it for anything customers or other teams touch. Recommendation: allow it as an approved utility for internal scripts, and keep Artisan as the standard for everything else.
For engineering leads: Treat this as a scalpel. It parses argv into options and arguments and stops there — no help generation, no subcommands, no validation, no container awareness. Use it for standalone scripts where booting Symfony Console is disproportionate; do not use it inside Artisan, where it duplicates existing behavior and risks inconsistent error handling. Two operational notes to carry into the decision: it has essentially no external dependents, so its release cadence tracks PHPUnit rather than our roadmap, and its major versions move the PHP floor (v5.x requires newer than PHP 8.3; v4.x is the fallback for 8.2/8.3). If the tool matters to the business, budget for owning the surrounding validation and help text ourselves.
For developers: One job done well — turn $argv into structured options without a framework. Install with composer require --dev sebastian/cli-parser, pass your option spec to the parser, and handle validation and --help yourself. Reach for it when you'd otherwise be hand-rolling argv parsing in a standalone script; reach for Symfony Console or Laravel Zero the moment you need subcommands, arrays, or prompts.
How can I help you explore Laravel packages today?