Web Niraj
  • Facebook
  • Flickr
  • Github
  • Linkedin
  • Twitter
  • YouTube
Online portfolio, code examples and developer blog
  • About
  • Contact
  • Portfolio
  • WordPress
Search the site...
  • Home
  • Blog
  • Laravel 5.2: More SSH / SFTP Commands

Laravel 5.2: More SSH / SFTP Commands

1

Following on from my previous tutorial on writing code to access SSH / SFTP servers, I recently found that the SSH library from LaravelCollective uses was quite limited in what it allowed. However, by accessing the underlying libraries, you can extend the functionality available to you.

For instance, I wanted to get the list of files on a remote SFTP server, but the SSH Facade in Laravel didn’t have this functionality. Digging into the source code revealed that the phpseclib library was being used, which has  a lot more supported functions.

The underlying functions can be accessed using:

SSH::getGateway()->getConnection()->function($params);

Where function is a supported phpseclib function, and $params are any parameters needed for the function.

Examples

Here are just some of the extra functionality you can achieve using the phpseclib library:

https://gist.github.com/niraj-shah/2d9d8ce2f3193f795a5c133cebb6476a

Laravel 5, PHP, SFTP, SSH

One comment on “Laravel 5.2: More SSH / SFTP Commands”

  1. Joseph H. says:
    December 5, 2020 at 12:29 AM

    Thank you very much! Very usefull

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

StackExchange / StackOverflow

profile for Niraj Shah on Stack Exchange, a network of free, community-driven Q&A sites

Support Me

PSN Profile

Tags

ACL Amazon Amazon Web Services Android Android 4.4 KitKat Android 5.0 Lollipop Apache Backup Bug Command Line Cordova cPanel / WHM Facebook Facebook Graph API Facebook PHP SDK 4.0 Facebook Social Plugins Fan Page Firewall Flash Gadget Geolocation Google Nexus 5 Hacking HTML5 iOS JavaScript jQuery Laravel 5 Linux NodeJS Parse PDF PHP Plugin Portfolio PS4 Review Security Server SSH SSL Sysadmin Tutorial WordPress WordPress Plugins
© 2011-2025 Niraj Shah
  • Blog
  • Portfolio
  • WordPress
  • About Me
  • Contact Me
  • Privacy Policy