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

Console Laravel Package

spiral/console

Spiral Console provides a simple, extensible CLI framework for building command-line tools and application commands in Spiral apps. Define commands, arguments, options, and interactive prompts with clean APIs, integrated with the Spiral container and environment.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install via Composer: composer require spiral/console
  • First use case: Create and register your first command by extending Spiral\Console\Command. Commands auto-discover if placed under src/Command (configurable) and annotated with #[AsCommand] (Symfony-style attributes).
  • Check the config/console.php file (if published) to tweak command discovery paths and default options.
  • Run php ./app.php list (or php index.php list depending on app bootstrap) to see all registered commands.

Implementation Patterns

  • Command sequencing: Use #[Sequence(...)] attribute on commands to define dependencies or execution order (e.g., #[Sequence('db:migrate', 'db:seed')]).
  • Auto-discovery: Commands are auto-registered if they implement Spiral\Console\Composable and reside in configured namespaces—no manual binding required in service providers.
  • Input/Output integration: Leverage Symfony-style InputInterface and OutputInterface for customarg parsing and colored output; Spiral wraps these with additional convenience methods (e.g., ask(), confirm(), table()).
  • Extensibility via traits: Use HasPrompt trait for interactive prompts or AsksForConfirmation for reusable confirmation logic across commands.

Gotchas and Tips

  • Legacy codebase warning: This is a subtree split (last updated 2020); compatibility with modern Laravel/Symfony versions is not guaranteed—expect deprecation warnings for Symfony\Component\Console v6+.
  • Attribute namespace quirk: The #[AsCommand] and #[Sequence] attributes live in Spiral\Console\Attribute, not Symfony’s Symfony\Component\Console\Attribute. Confusing if you’re used to standard Symfony conventions.
  • Debug tip: Run commands with -vvv to see auto-discovery logs—watch for commands skipped due to missing #[AsCommand] or invalid signatures.
  • Workaround for missing Laravel integration: Unlike full Spiral Framework, this package doesn’t auto-bind commands to Laravel’s console kernel—manually register them in app/Console/Kernel.php or use Command::resolveFromContainer() to hook into IoC.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport