acassan/remoteserver
Laravel/PHP package to connect to a remote server and execute actions or processes. Useful for running commands, triggering tasks, or managing remote operations from your application.
execute()).upload(), download()).RemoteServer::execute()).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| SSH Credential Leaks | High | Use Laravel’s env() + Vault (e.g., HashiCorp) for secrets. Never hardcode. |
| Network Latency | Medium | Implement circuit breakers (e.g., spatie/flysystem-circuit-breaker). |
| Package Abandonment | Medium | Fork/maintain if critical; add tests/contrib. |
| Permission Issues | High | Validate remote server permissions pre-deployment. |
| Dependency Bloat | Low | Package is minimal; no major conflicts. |
config() or a dedicated secrets manager?phpseclib mocks or Dockerized test servers.)phpseclib/phpseclib (no conflicts with Laravel’s core).$this->app->bind(RemoteServerInterface::class, function ($app) {
return new \Acassan\RemoteServer\RemoteServer(
$app['config']['remote_servers.default']
);
});
league/glide: Better for file transfers but lacks SSH.phpseclib directly: More control but higher boilerplate.Artisan + SSH: Overkill for simple remote actions.artisan ssh:command) with the package.exec('ssh user@host command')).class RemoteServerFacade {
public function run(string $command, string $server): string {
return app(RemoteServerInterface::class)
->connect($server)
->execute($command);
}
}
class RemoteBackupJob implements ShouldQueue {
public function handle() {
RemoteServerFacade::run('backup.sh', 'backup-server');
}
}
phpseclib compatibility.-t flag for pseudo-terminals.->setTTY(true).config/remote_servers.php:
'default' => [
'host' => 'remote.example.com',
'username' => env('REMOTE_USER'),
'password' => env('REMOTE_PASSWORD'), // or key path
],
docker run -it ubuntu bash) for local testing.acassan/remoteserver for updates (low priority; MIT license implies minimal maintenance).phpseclib may require updates; pin versions in composer.json:
"phpseclib/phpseclib": "^3.0",
config/ to avoid hardcoding.connect_timeout in package config.~/.ssh/authorized_keys.->setVerbose(true)).ssh -vvv to replicate issues locally.Log::debug() for package output.$server = new RemoteServer($config);
$server->connect(); // Reuse connection for multiple commands
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| SSH Server Unreachable | Job failures | Retry with exponential backoff. |
| Authentication Failure | All remote actions blocked | Monitor credential rotation. |
| Command Timeout | Partial task completion | Set reasonable timeouts (e.g., 30s). |
| Network Partition | Latency spikes | Circuit breaker (e.g., spatie/...). |
| Remote Disk Full | File upload failures | Validate disk space pre-upload. |
| Package Bug | Undefined behavior | Fork + tests; avoid in production. |
RemoteServer::execute()).How can I help you explore Laravel packages today?