Weave 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

Laravel Shell Laravel Package

jakyeru/laravel-shell

Run shell commands from Laravel through a simple, testable API. jakyeru/laravel-shell wraps process execution, captures output and exit codes, and fits neatly into Artisan commands, jobs, and services for reliable command-line automation.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require valentinneaga/laravel-shell. There is no configuration step required for the default behaviour — the service provider registers the shell command on boot.
  • Pin your constraint deliberately. v4.0.0 is the Laravel 13 line. If the app is still on Laravel 11 or 12, require ^3.0 instead; the major bump signals that the Laravel 13 support was not added as a widening constraint (e.g. ^11|^12|^13) but as a new major. Check composer.json in the tag before upgrading a multi-app codebase.
  • Where to look first: src/Terminal.php — it is one of only two things that changed in v4.0.0, so it is the file that will bite you. Then the service provider, to see how the command is registered and whether anything is publishable.
  • First use case: boot the full application in an interactive shell and interrogate live state rather than sprinkling dd() through controllers. Resolve services, run Eloquent queries, dispatch a job and inspect the result, all against real container bindings and real config — which is exactly the gap php artisan tinker leaves when you need framework bootstrapping plus command execution.
  • Before you build anything on top of it, run the shell once locally and once in the target environment (staging container, CI runner). The v4.0.0 Terminal.php change is most likely to surface as a behavioural difference in non-TTY contexts, and you want that discovered on day one, not in a deploy script.

Implementation Patterns

  • REPL-first, code-second. Use the shell to prove an approach interactively, then move the proven snippet into a command or test. This is the highest-value daily pattern: the shell is a scratchpad against real dependencies, not a production interface.
  • Wrap recurring snippets in an Artisan command. Anything you type into the shell more than three times belongs in a dedicated command that calls the terminal/process layer directly. Keep the shell for exploration and the command for repeatability.
  • Capture output and exit codes explicitly. When invoking terminal execution programmatically (from a command, a job, or a health check), treat it as a process invocation: read stdout and stderr separately, check the exit status, and fail loudly on non-zero. Never assume the call succeeded because no exception was thrown.
  • Gate interactive usage. Guard shell entry points with $this->input->isInteractive() and an environment check (app()->isLocal() or an explicit allowlist). A shell that can be reached from a queued worker or a web route in production is an incident waiting to happen.
  • Config-driven command allowlists. If the package exposes a config file, publish it and drive permitted commands/binaries from config rather than hardcoding them in the command class. This keeps environment differences (local vs. container vs. CI) out of your PHP code.
  • Version-gate shared code. If several apps share internal tooling built on this package, keep the terminal-touching code behind a thin adapter class so an app on ^3.0 and an app on ^4.0 can coexist while you migrate. The Terminal.php change makes direct static calls risky across versions.
  • CI integration. For pipelines, prefer a non-interactive, single-shot invocation over the interactive shell, and assert on exit codes. Interactive shells are for humans; pipelines should call the deterministic entry point.

Gotchas and Tips

  • The release notes are thin — read the diff. v4.0.0 lists only "add Laravel 13 support" and "Updated Terminal.php". A major version bump with an unexplained Terminal.php change is the classic signature of an unannounced breaking change: altered method signatures, changed return types, or different handling of output/streams. Review compare/v3.0.0...v4.0.0 before upgrading anything you depend on.
  • Laravel 13 raises the PHP floor. Confirm the package's php constraint in the v4.0.0 tag against your runtime images. A package upgrade that silently requires a newer PHP than your base image is a build failure at the worst possible moment.
  • Non-TTY behaviour is the usual suspect. Terminal/process wrappers commonly branch on whether a real TTY is attached — this affects ANSI colour output, paging, and prompts. If v4.0.0 touched Terminal.php, re-test inside Docker, in CI, and behind a queued job, not just in your local terminal.
  • Escape everything. Any value that reaches a shell invocation must be escaped (escapeshellarg) or, better, passed as an argument array rather than interpolated into a string. User-influenced input into a shell wrapper is remote code execution with extra steps.
  • Timeouts and hangs. Long-running commands invoked from the shell block the process indefinitely by default. Set an explicit timeout for anything called from a command or job, and log the command line (minus secrets) on timeout so you can reproduce it.
  • Debugging failures. Re-run with -vvv to see the underlying process invocation; if the command exits instantly with no output, check proc_open/exec in disable_functions in php.ini — shared hosts and hardened containers disable them and the failure looks like a package bug.
  • Extension point: if the terminal implementation is bound in the container, prefer binding your own subclass over forking the package. That keeps you upgrade-safe across the v4 line and lets you add logging, redaction, or environment guards without patching vendor/.
  • Watch for the next patch. Given how sparse these notes are, expect a 4.0.1 clarifying or fixing the Terminal.php change. Don't build deep abstractions on top of v4.0.0 internals until the API settles.
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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin