Blesta Source Documentation

Ftp

FTP wrapper for DiRete\microftps

Table of Contents

Constants

CONNECTION_ERROR

Properties

$ftp An instance of \DiRete\microftps
$options Any options to pass for the FTP connection
$password The FTP server password
$server The FTP server URL
$username The FTP server username

Methods

__construct()
connect() Attempts to connect to the FTP server
delete() Deletes the remote file at the given path
listDir() List directory
read() Reads the file from the remote system
setCredentials() Sets login credentials for the FTP connection
setOptions() Sets options to use for the FTP connection
setServer() Sets the FTP server URL to connect to
write() Writes the file from the local system to the remote system
connectFtp() Attempts to connect to the server
Constants

CONNECTION_ERROR

public mixed CONNECTION_ERROR = 'Could not connect to FTP server.'
Properties

$ftp

An instance of \DiRete\microftps

private mixed $ftp

$options

Any options to pass for the FTP connection

private mixed $options = []

$password

The FTP server password

private mixed $password

$server

The FTP server URL

private mixed $server

$username

The FTP server username

private mixed $username
Methods

__construct()

public __construct([string $server = '' ][, string $username = '' ][, string $password = '' ][, array<string|int, mixed> $options = [] ]) : mixed
Parameters
$server : string = ''

The IP/domain of the server to connent to

$username : string = ''

The username to connect with

$password : string = ''

The password to connect with

$options : array<string|int, mixed> = []

The options to use for the connection including:

  • passive
  • port
  • timeout
  • curlOptions

connect()

Attempts to connect to the FTP server

public connect() : mixed

delete()

Deletes the remote file at the given path

public delete(string $path) : mixed
Parameters
$path : string

The path to delete the file from the server

Tags
throws
Exception
Return values
mixed

The result

listDir()

List directory

public listDir(string $dir) : array<string|int, mixed>
Parameters
$dir : string

Directory to list

Tags
throws
Exception
Return values
array<string|int, mixed>

read()

Reads the file from the remote system

public read(string $path) : mixed
Parameters
$path : string

The path to read the file from the server

Tags
throws
Exception
Return values
mixed

The result

setCredentials()

Sets login credentials for the FTP connection

public setCredentials(string $username, string $password) : mixed
Parameters
$username : string

The FTP username

$password : string

The FTP password

setOptions()

Sets options to use for the FTP connection

public setOptions(array<string|int, mixed> $options) : mixed
Parameters
$options : array<string|int, mixed>

The options to use for the connection including:

  • passive
  • port
  • timeout
  • curlOptions

setServer()

Sets the FTP server URL to connect to

public setServer(type $server) : mixed
Parameters
$server : type

write()

Writes the file from the local system to the remote system

public write(string $from_path, string $to_path) : mixed
Parameters
$from_path : string

The path to the local file

$to_path : string

The path to write the file to on the server

Tags
throws
Exception
Return values
mixed

The result

connectFtp()

Attempts to connect to the server

private connectFtp() : bool
Tags
throws
Exception
Return values
bool

Whether or not the FTP connection can be made


        
On this page

Search results