issue

Firstly, need to know the connection must be using curl to call, but laravel doesn’t integrate it, fortunately, vyuldashev makes CurlFtpAdapter, it can solve the issue perfectly, but now, how to integrate to laravel?

official docs

Creating CurlFtpServiceProvider

$ php artisan make:provider CurlFtpServiceProvider

Extending Storage

<?php

namespace App\Providers;

use Storage;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use VladimirYuldashev\Flysystem\CurlFtpAdapter;

class CurlFtpServiceProvider extends ServiceProvider
{
    /**
     * Register bindings in the container.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Storage::extend('curl-ftp', function ($app, $config) {
            $adapter = new CurlFtpAdapter($config);

            return new Filesystem($adapter);
        });
    }
}

Configurations

Next, put in configurations to config/filesystems.php

'curlftp' => [
    'driver'   => 'curl-ftp',
    'host' => 'ftp.example.com',
    'username' => 'username',
    'password' => 'password',

    /** optional config settings */
    'port' => 21,
    'root' => '/path/to/root',
    'utf8' => true,
    'ssl' => true,
    'timeout' => 90,		// connect timeout
    'sslVerifyPeer' => 0, // using 0 is insecure, use it only if you know what you're doing
    'sslVerifyHost' => 0, // using 0 is insecure, use it only if you know what you're doing
    
    /** proxy settings */
    'proxyHost' => 'proxy-server.example.com',
    'proxyPort' => 80,
    'proxyUsername' => 'proxyuser',
    'proxyPassword' => 'proxypassword',
],

Registering service provider

Finally, you need to register in config/app.php

'providers' => [
    // ...
    App\Providers\CurlFtpServiceProvider::class,
];