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

Web Terminal Laravel Package

mwguerra/web-terminal

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Core Fit: The package excels in Filament/Laravel admin panels where CLI access (e.g., debugging, server management) is needed without exposing full SSH. Its PTY/streaming capabilities align with Laravel’s Livewire/Alpine.js ecosystem, enabling real-time terminal UIs.
  • Multi-Tenancy: Native support for tenant isolation (via Laravel Nova/Forge or custom SaaS stacks) reduces architectural overhead for shared-hosting scenarios.
  • Security Model: Command whitelisting and enum-based permissions integrate cleanly with Laravel’s Gate/Policy system, avoiding custom middleware bloat.

Integration Feasibility

  • Laravel 12/13: Minimal friction with Livewire 4.x and Filament 5.x, but requires PHP 8.3+ (check CI/CD compatibility).
  • SSH Dependencies: Relies on PHP-SSH libraries (e.g., phpseclib) and system binaries (tmux, ghostty). Docker/Kubernetes deployments may need sidecar containers for tmux or xvfb.
  • WebSocket Backend: Requires Laravel Echo/Pusher or Laravel WebSockets for real-time streaming. Self-hosted setups need Redis for pub/sub.

Technical Risk

  • PTY Complexity: Ghostty-web (for TUI apps) introduces browser-side rendering quirks (e.g., font scaling, terminal emulation bugs). Test with vim/htop early.
  • SSH Performance: Remote sessions may time out under high load. Configure phpseclib timeouts and WebSocket ping intervals.
  • Local Shell Security: Whitelisting misconfigurations could expose sensitive commands. Audit allowed_commands via Laravel Telescope.
  • Filament Version Lock: Filament 5.x is still evolving; check for breaking changes in Filament 6.x compatibility.

Key Questions

  1. Deployment Model:
    • Will terminals run in local shell mode (higher risk) or SSH-only (recommended for production)?
    • How will tmux/PTY dependencies be managed in CI/CD (e.g., GitHub Actions, Kubernetes)?
  2. Scaling:
    • What’s the max concurrent sessions needed? WebSocket scaling may require Laravel Horizon or Pusher Enterprise.
  3. Audit Requirements:
    • Does the logging system meet compliance needs (e.g., GDPR, SOC2)? Consider Laravel’s log driver extensions.
  4. Customization:
    • Are custom scripts needed beyond the built-in TerminalScript class? Extend via Laravel Events.
  5. Fallbacks:
    • Plan for WebSocket failures (e.g., fallback to polling or static command output).

Integration Approach

Stack Fit

  • Primary Use Case: Filament Admin Panels (e.g., dev tools, server management).
  • Alternatives:
    • Livewire Standalone: Use the Livewire component in custom Blade views (no Filament).
    • API Wrapper: Expose terminal commands via Laravel Sanctum for frontend frameworks (React/Vue).
  • Compatibility Matrix:
    Component Laravel 12/13 Filament 5.x Livewire 4.x PHP 8.3+
    Core Terminal
    SSH Connections ✅ (phpseclib)
    PTY/Streaming ✅ (ghostty)
    Filament UI

Migration Path

  1. Pilot Phase:
    • Install in a staging environment with composer require mwguerra/web-terminal.
    • Test local shell mode first (lower risk than SSH).
    • Validate Filament integration via php artisan vendor:publish --tag="web-terminal-assets".
  2. SSH Rollout:
    • Configure ~/.ssh/config for key-based auth (avoid passwords).
    • Test with whitelisted commands (e.g., ls, php artisan queue:work).
  3. PTY Optimization:
    • Install tmux and ghostty in Docker or server base images.
    • Test TUI apps (e.g., htop) in Chrome/Firefox for rendering issues.
  4. WebSocket Setup:
    • Install laravel-websockets or configure Pusher.
    • Set WEBSOCKETS_ENABLED=true in .env.

Compatibility

  • Laravel:
    • Queue Workers: Ensure queue:work is whitelisted for Reverb/Horizon compatibility.
    • Artisan Commands: Test interactive commands (e.g., tinker, make:migration).
  • Filament:
    • Permission Policies: Extend TerminalPermission enum for custom roles.
    • Widgets: Customize Terminal Logs resource via Filament’s Resource class.
  • Browser Support:
    • WebSocket: Test in Chrome, Firefox, Edge (Safari may need polyfills).
    • PTY: Ensure WebGL is enabled for ghostty-web.

Sequencing

  1. Phase 1: Local shell + basic commands (1–2 weeks).
  2. Phase 2: SSH integration + whitelisting (1 week).
  3. Phase 3: PTY/streaming + Filament UI (2 weeks).
  4. Phase 4: Multi-tenancy + logging/auditing (1 week).

Operational Impact

Maintenance

  • Dependency Updates:
    • Monitor Filament 6.x for breaking changes.
    • Pin phpseclib and ghostty-web versions in composer.json.
  • Security Patches:
    • SSH libraries may require updates (e.g., libssh vulnerabilities).
    • Command whitelists should be version-controlled (e.g., in config/web-terminal.php).
  • Logging:
    • Extend TerminalLog model to include user-agent/IP for forensics.
    • Archive logs via Laravel’s log-archive package.

Support

  • Common Issues:
    • PTY Failures: Debug with ghostty-web logs (check browser console).
    • SSH Timeouts: Adjust phpseclib settings in config/web-terminal.php.
    • Permission Denied: Verify storage/framework/sessions and bootstrap/cache permissions.
  • Documentation Gaps:
    • Custom Scripts: Add examples for parallel command execution.
    • Docker Setup: Document tmux/PTY container requirements.
  • SLAs:
    • Terminal Uptime: Aim for 99.9% (WebSocket-dependent).
    • Command Response: <2s for local, <5s for SSH (SLA targets).

Scaling

  • Horizontal Scaling:
    • WebSocket: Use Laravel Horizon or Pusher clusters.
    • SSH Load: Offload to dedicated SSH bastion hosts.
  • Vertical Scaling:
    • PHP Workers: Increase queue:work processes for TerminalJob.
    • Redis: Scale for WebSocket pub/sub (e.g., Redis Cluster).
  • Database:
    • Terminal Logs: Partition by tenant_id or created_at for large-scale SaaS.

Failure Modes

Failure Scenario Mitigation Strategy Workaround
WebSocket Disconnection Retry logic in Livewire + reconnect button Fallback to polling mode
SSH Server Down Health checks + circuit breakers Notify admins via Filament alerts
PTY Rendering Issues Feature flags for TUI apps Disable PTY for problematic users
Command Injection Strict whitelisting + Laravel Gates Rate-limit API endpoints
Database Lock Contention Optimize TerminalLog queries Read replicas for logs

Ramp-Up

  • Onboarding:
    • Dev Setup: Provide docker-compose.yml with tmux/PTY pre-installed.
    • Admin Training: Record a Loom video for Filament terminal configuration.
  • Performance Tuning:
    • Benchmark command execution time (local vs. SSH).
    • Profile **Web
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.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware