I would like to use phpseclib librabry in my CakePHP 2.8 application. After installation of all dependencies into app/Vendor directory I am trying to try phpseclib installation.
But I am not able to load library:
include('Net/SFTP.php');
$sftp = new Net_SFTP('127.0.0.1');
but this error occures:
Error: Class 'Net_SFTP' not found
In AppController I'm loading auto-generated include and I thought it must be done:
require_once ROOT . DS . 'vendors' . DS . 'autoload.php';
What am I missing?
If your using composer then you just need to include composers autoloader. You don't need to include the specific libraries (thats the point of composers autoloader).
If you look at the source code of the library you'll notice that it's namespaced (https://github.com/phpseclib/phpseclib/blob/2.0.4/phpseclib/Net/SFTP.php#L38). So you need either import the namespace with the
usestatement, or:$sftp = new phpseclib\Net\SFTP('127.0.0.1');