Question

As per title, has anyone achieved this? What are the best practices on including this library into codeigniter (v2.1.2) ?

I know it can be done by simply using include/require statements like any other PHP application, however as this project will be handed over to multiple devs once complete, I want to ensure it's built correctly using the design patterns the CI dev intended.

I've tried the following in a test controller

public function index(){

    $this->load->library('phpseclib0.3.0/Net/SFTP');

}

However I'm greeted with:

Non-existent class: SFTP

phpseclib taken from here.

Was it helpful?

Solution

the $this->load->library method is for libraries that already exist within codeigniter.

You could create a wrapper for the PHPSecLib class, however what's probably easiest at the moment is to simply include it.

  1. Download the source code fromm phpseclib's page.
  2. Upload it to the /application/third_party folder
  3. include the file.

    include(APPPATH . '/third_party/phpseclib/Net/SSH2.php');

  4. Create an instance of class your wanting to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top