Search code examples
phplaravelcomposer-php

Laravel SFTP class not found


I upgraded laravel to V5.6.7 where sftp driver is included.

I have set my config in config/filesystems.php

'sftp' => [
    'driver'   => 'sftp',
    'host'     => 'myhost.com',
    'username' => 'user',
    'password' => 'password',
],

And when I do

dd( Storage::disk('sftp')->files('/') );

This throw Class 'League\Flysystem\Sftp\SftpAdapter' not found

And indeed, this class does not exist in my vendor folder.

But my composer.json is like this

{
    "require": {
        ....
        "laravel/framework": "~5.6.7",
        ....
},

And composer update tell me that everything is updated.

What should I do to get this class?


PS: When I dump another disk, it's working very well


Solution

  • From the PR on github

    SFTP driver requires league/flysystem-sftp so it should be added to composer file as in case of AWS or Rackspace drivers.

    you need to do this

    composer require league/flysystem-sftp
    

    Instruction here

    @Devon (thanks)

    Also form LARAVEL.COM

    Driver Prerequisites
    Composer Packages
    Before using the SFTP, S3, or Rackspace drivers, you will need to install the appropriate package via Composer:
    
    SFTP: league/flysystem-sftp ~1.0
    Amazon S3: league/flysystem-aws-s3-v3 ~1.0
    Rackspace: league/flysystem-rackspace ~1.0