$connection
$connection : \FTP\Connection|null
Ftp Adapter Class.
This class implements the FilesystemAdapterInterface
, FileFactoryInterface
,
ListKeysAwareInterface
, and SizeCalculatorInterface
to provide an FTP
filesystem adapter. It enables operations such as connecting to an FTP server,
listing directories, retrieving file sizes, and managing file paths on the server.
This adapter supports features such as passive mode, SSL connections, and UTF-8 encoding. It allows for creating directories on the remote server if needed and handles the necessary configuration parameters for establishing the FTP connection.
__construct(array $config) : mixed
Ftp constructor.
Initializes the FTP adapter with the specified configuration options.
array | $config | Configuration options for the FTP connection. Supported options include:
|
if the FTP extension is not loaded.
listDirectory(string $directory = '') : array
Lists the contents of the specified directory.
string | $directory | The directory to list. If empty, uses the default directory. |
if the directory does not exist and cannot be created.
An array containing 'keys' (file paths) and 'dirs' (subdirectory paths).
createFile(string $key, \Omega\Filesystem\Filesystem $filesystem) : \Omega\Filesystem\File
Creates a new File instance.
string | $key | The unique key that identifies the file in the filesystem. |
\Omega\Filesystem\Filesystem | $filesystem | The filesystem instance that will manage the file. |
Returns a new instance of the File
class.
ensureDirectoryExists(string $directory, bool $create = false) : void
Ensures that the specified directory exists.
string | $directory | The directory to check. |
bool | $create | Whether to create the directory if it does not exist. |
if the directory does not exist and cannot be created.
fetchKeys(string $directory = '', bool $onlyKeys = true) : array
Fetches all keys (file and directory paths) from the specified directory.
string | $directory | The directory to fetch keys from. |
bool | $onlyKeys | Whether to return only file keys. |
An array containing 'keys' (file paths) and 'dirs' (subdirectory paths).