spatie/ssh
Execute commands over SSH with a simple PHP API. Create a connection with user/host (and optional port), run single or multiple commands synchronously or async, and get a Symfony Process back to inspect success and capture output.
Architecture fit: The package integrates seamlessly with Laravel's existing Symfony dependencies, providing a lightweight wrapper for SSH command execution. Its minimalistic design aligns well with typical Laravel use cases for remote server management, avoiding unnecessary complexity.
Integration feasibility: Composer installation is straightforward, and it leverages Symfony's Process component (already in Laravel's stack). However, password-based auth requires sshpass on the host system, adding a system-level dependency that must be pre-installed.
Technical risk: Low codebase risk due to Spatie's reputation and test coverage, but "Dependents: 0" is concerning for adoption validation. Silent failures for missing sshpass and potential security implications of disabling host key checks require careful handling.
Key questions: How does it handle SSH key permissions and credential rotation? What are the performance characteristics under high-concurrency scenarios? Are there known compatibility issues with specific SSH server versions or network environments?
Stack fit: Fully compatible with Laravel 8+ (PHP 8.2+), leveraging Symfony 6-8 components. Works in both Linux and Windows environments (with removeBash() for Windows targets).
Migration path: Replace existing SSH implementations with Ssh::create() calls. For projects using phpseclib, migration requires refactoring command execution logic but benefits from simpler API. Test password auth and jump host configurations early.
Compatibility: Supports all modern PHP versions (8.2-8.4) and Symfony 6-8. Ensure Laravel version matches Symfony constraints (e.g., Laravel 10 uses Symfony 6, Laravel 11 uses Symfony 7).
Sequencing: 1) Install via Composer, 2) Audit existing SSH usage patterns, 3) Implement in non-critical workflows first (e.g., deployment scripts), 4) Validate password/jump host configurations in staging, 5) Roll out to production with monitoring.
Maintenance: Low effort due to Spatie's active maintenance
How can I help you explore Laravel packages today?