Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cli Parser Laravel Package

sebastian/cli-parser

Parse PHP CLI arguments from $_SERVER['argv'] with a small, focused library extracted from PHPUnit. Ideal for building command-line tools and test runners, providing straightforward handling of options and parameters with minimal dependencies.

View on GitHub
Deep Wiki
Context7

Library for parsing CLI options

Frequently asked questions about Cli Parser
Can I use sebastian/cli-parser to build Laravel Artisan commands?
No, this package is not designed for Laravel Artisan. It lacks integration with Laravel’s service container, command bus, or Symfony Console’s features like subcommands or auto-help. Use Symfony Console or Laravel’s native tools instead.
What’s the difference between sebastian/cli-parser and Symfony Console?
Symfony Console is Laravel’s built-in CLI framework, offering command registration, input binding, and I/O handling. sebastian/cli-parser is a low-level parser for raw `$_SERVER['argv']`—it doesn’t replace Symfony Console’s full feature set.
How do I install sebastian/cli-parser in a Laravel project?
Run `composer require sebastian/cli-parser` for a project dependency or `composer require --dev sebastian/cli-parser` for development-only use. However, avoid using it for Artisan commands; it’s meant for standalone scripts.
Does sebastian/cli-parser support Laravel’s service container?
No, this package has no Laravel integration. It’s a standalone parser with no awareness of Laravel’s dependency injection or Artisan’s lifecycle. Use Symfony Console for Laravel-specific CLI tools.
Can I use this package for deployment scripts or one-off CLI tools in Laravel?
Yes, if your script is standalone (not an Artisan command), you can parse `$_SERVER['argv']` with this library. Just avoid mixing it with Laravel’s CLI stack to prevent conflicts.
What Laravel versions does sebastian/cli-parser support?
This package isn’t Laravel-specific, but its PHP version constraints (e.g., PHP 8.2+) may conflict with Laravel’s minimum requirements (PHP 8.1+). Check compatibility before use in production.
How do I handle parsed options in Laravel after using sebastian/cli-parser?
Since this package doesn’t integrate with Laravel, you’ll need manual mapping. For example, convert parsed options to Laravel’s `Request` or `Input` objects via custom logic, but this isn’t recommended for Artisan commands.
Are there alternatives to sebastian/cli-parser for Laravel CLI tools?
For Artisan commands, use Symfony Console (already integrated). For lightweight CLI tools, consider Laravel Zero or Symfony’s CLI Component. This package is only useful for non-Laravel scripts.
Does sebastian/cli-parser work with Laravel’s event system or middleware?
No, it has no support for Laravel’s events, middleware, or Artisan’s command lifecycle. It’s a parser-only tool with no awareness of Laravel’s architecture.
What maintenance risks should I consider with sebastian/cli-parser in Laravel?
As a PHPUnit internal tool, this package may deprioritize external compatibility. Breaking changes could occur, especially if you rely on it for production scripts. Prefer Symfony Console or Laravel Zero for long-term projects.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata