FTPService
class FTPService implements ServiceInterface (View source)
Constants
| private CONFIG_HOSTNAME |
|
| private CONFIG_PORT |
|
| private CONFIG_TIMEOUT |
|
| private CONFIG_USERNAME |
|
| private CONFIG_PASSWORD |
|
| private CONFIG_ROOT |
|
| private CONFIG_TLS |
|
| private CONFIG_PASSIVE |
|
| private DEFAULT_PORT |
|
| private DEFAULT_TIMEOUT |
|
| private DEFAULT_TLS |
|
| private DEFAULT_PASSIVE |
|
| private MAX_RETRY_ATTEMPTS |
|
| private RETRY_DELAY_SECONDS |
|
Methods
Connect to the FTP server with retry logic
Disconnect from the FTP server
Change working directory
Destructor - ensure connection is closed
Configure service
Return the current working directory.
Store uploaded file to FTP server
Get ftp connection
Append content to file
Prepend content to file
Get file content from FTP server
Put content to file on FTP server
List files in a directory
List directory contents
List directories
Create a directory recursively
Create a single directory
Copy file from source to target
Rename or move a file from source to target
Check if path is a file
Check if path is a directory
Resolves a path.
Check if file or directory exists
Delete file from FTP server
Details
void
connect()
Connect to the FTP server with retry logic
void
disconnect()
Disconnect from the FTP server
void
changePath(string|null $path = null)
Change working directory
__destruct()
Destructor - ensure connection is closed
static FilesystemInterface
configure(array $config)
Configure service
mixed
getCurrentDirectory()
Return the current working directory.
array|bool|string
store(UploadedFile $file, string|null $location = null, array $option = [])
Store uploaded file to FTP server
Connection
getConnection()
Get ftp connection
bool
append(string $file, string $content)
Append content to file
bool
prepend(string $file, string $content)
Prepend content to file
string|null
get(string $file)
Get file content from FTP server
bool
put(string $file, string $content)
Put content to file on FTP server
array
files(string $dirname = '.')
List files in a directory
protected array
listDirectoryContents(string $directory = '.')
List directory contents
array
directories(string $dirname = '.')
List directories
bool
makeDirectory(string $dirname, int $mode = 0777)
Create a directory recursively
protected bool
makeActualDirectory(string $directory)
Create a single directory
bool
copy(string $source, string $target)
Copy file from source to target
bool
move(string $source, string $target)
Rename or move a file from source to target
bool
isFile(string $file)
Check if path is a file
bool
isDirectory(string $dirname)
Check if path is a directory
string
path(string $file)
Resolves a path.
Give the absolute path of a path
bool
exists(string $path)
Check if file or directory exists
bool
delete(string $file)
Delete file from FTP server