oprudkyi/flysystem-curlftp

使用cURL实现的FTP适配器(支持通过TLS的隐式FTP和代理)

3.0.1 2024-03-15 21:16 UTC

This package is auto-updated.

Last update: 2024-09-15 22:17:07 UTC


README

Latest Stable Version Build Status StyleCI License

此包包含一个使用cURL实现的Flysystem FTP适配器。虽然与Flysystem FTP Adapter兼容,但它还提供了以下支持:

  • 通过TLS的隐式FTP(FTPS
  • 代理

它是对flysystem-curlftp的分支,也是一个临时的替代品

  • 支持Flysystem V2/V3
  • 基于flysystem-ftp重新实现
  • 更新了依赖项
  • phpstan等级6

安装

您可以通过composer安装此包

composer require oprudkyi/flysystem-curlftp

用法

use League\Flysystem\Filesystem;
use VladimirYuldashev\Flysystem\CurlFtpAdapter;
use VladimirYuldashev\Flysystem\CurlFtpConnectionOptions;

$adapter = new CurlFtpAdapter(
  CurlFtpConnectionOptions::fromArray([
      'host' => 'ftp.example.com',
      'username' => 'username',
      'password' => 'password',

      /** optional config settings */
      'port' => 21,
      'root' => '/path/to/root',
      'utf8' => true,
      'ftps' => true, // use ftps:// with implicit TLS or ftp:// with explicit TLS
      'ssl' => true,
      'timeout' => 90, // connect timeout
      'passive' => true, // default use PASV mode
      'ignorePassiveAddress' => true, // ignore the IP address in the PASV response
      '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
      'timestampsOnUnixListingsEnabled' => true,

      /** proxy settings */
      'proxyHost' => 'proxy-server.example.com',
      'proxyPort' => 80,
      'proxyUsername' => 'proxyuser',
      'proxyPassword' => 'proxypassword',

      'verbose' => false // set verbose mode on/off
    ])
);

$filesystem = new Filesystem($adapter);

测试

$ composer test

从1.x升级

  • 使用CurlFtpConnectionOptions创建适配器
    use VladimirYuldashev\Flysystem\CurlFtpAdapter;
    use VladimirYuldashev\Flysystem\CurlFtpConnectionOptions;
    ...
    $adapter = new CurlFtpAdapter(
      CurlFtpConnectionOptions::fromArray([
    ...

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件