{"id":16410552,"url":"https://github.com/skipperbent/ftp-client","last_synced_at":"2026-05-14T22:04:22.746Z","repository":{"id":57037396,"uuid":"57133015","full_name":"skipperbent/ftp-client","owner":"skipperbent","description":"Simple object oriented FTP wrapper for PHP.","archived":false,"fork":false,"pushed_at":"2016-05-17T23:06:50.000Z","size":302,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T07:46:26.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/skipperbent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-26T14:02:07.000Z","updated_at":"2016-04-26T14:06:30.000Z","dependencies_parsed_at":"2022-08-24T06:40:17.508Z","dependency_job_id":null,"html_url":"https://github.com/skipperbent/ftp-client","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/skipperbent/ftp-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fftp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fftp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fftp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fftp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skipperbent","download_url":"https://codeload.github.com/skipperbent/ftp-client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skipperbent%2Fftp-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33045149,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:43:15.835Z","updated_at":"2026-05-14T22:04:22.714Z","avatar_url":"https://github.com/skipperbent.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pecee/ftp-client\n\nA flexible FTP and SSL-FTP client for PHP.\nThis lib provides helpers easy to use to manage the remote files.\n\n\n## Install\n\n` composer require pecee/ftp-client`\n\n## Getting Started\n\nConnect to a server FTP :\n\n```php\n$ftp = new \\FtpClient\\FtpClient();\n$ftp-\u003econnect($host, $sslEnabled, $port);\n$ftp-\u003elogin($login, $password);\n```\n\nNote: The connection is implicitly closed at the end of script execution (when the object is destroyed). Therefore it is unnecessary to call `$ftp-\u003eclose()`, except for an explicit re-connection.\n\n\n### Usage\n\nUpload all files and all directories is easy:\n\n```php\n// upload with the BINARY mode\n$ftp-\u003euploadDirectory($sourceDirectory, $targetDirectory);\n\n// Is equal to\n$ftp-\u003euploadDirectory($sourceDirectory, $targetDirectory, FTP_BINARY);\n\n// or upload with the ASCII mode\n$ftp-\u003euploadDirectory($sourceDirectory, $targetDirectory, FTP_ASCII);\n```\n\n*Note : `FTP_ASCII` and `FTP_BINARY` are predefined PHP internal constants.*\n\nGet a directory size:\n\n```php\n// size of the current directory\n$size = $ftp-\u003egetDirectorySize();\n\n// size of a given directory\n$size = $ftp-\u003egetDirectorySize('/path/of/directory');\n```\n\nCount the items in a directory:\n\n```php\n// count in the current directory\n$total = $ftp-\u003ecount();\n\n// count in a given directory\n$total = $ftp-\u003ecount('/path/of/directory');\n\n// count only the \"files\" in the current directory\n$total_file = $ftp-\u003ecount('.', 'file');\n\n// count only the \"files\" in a given directory\n$total_file = $ftp-\u003ecount('/path/of/directory', 'file');\n\n// count only the \"directories\" in a given directory\n$total_dir = $ftp-\u003ecount('/path/of/directory', 'directory');\n\n// count only the \"symbolic links\" in a given directory\n$total_link = $ftp-\u003ecount('/path/of/directory', 'link');\n```\n\nDetailed list of all files and directories:\n\n```php\n// scan the current directory and returns the details of each item\n$items = $ftp-\u003escanDirectory();\n\n// scan the current directory (recursive) and returns the details of each item\nvar_dump($ftp-\u003escanDirectory('.', true));\n```\n\nResult:\n\n\t'directory#www' =\u003e\n\t    array (size=10)\n\t      'permissions' =\u003e string 'drwx---r-x' (length=10)\n\t      'number'      =\u003e string '3' (length=1)\n\t      'owner'       =\u003e string '32385' (length=5)\n\t      'group'       =\u003e string 'users' (length=5)\n\t      'size'        =\u003e string '5' (length=1)\n\t      'month'       =\u003e string 'Nov' (length=3)\n\t      'day'         =\u003e string '24' (length=2)\n\t      'time'        =\u003e string '17:25' (length=5)\n\t      'name'        =\u003e string 'www' (length=3)\n\t      'type'        =\u003e string 'directory' (length=9)\n\n\t  'link#www/index.html' =\u003e\n\t    array (size=11)\n\t      'permissions' =\u003e string 'lrwxrwxrwx' (length=10)\n\t      'number'      =\u003e string '1' (length=1)\n\t      'owner'       =\u003e string '0' (length=1)\n\t      'group'       =\u003e string 'users' (length=5)\n\t      'size'        =\u003e string '38' (length=2)\n\t      'month'       =\u003e string 'Nov' (length=3)\n\t      'day'         =\u003e string '16' (length=2)\n\t      'time'        =\u003e string '14:57' (length=5)\n\t      'name'        =\u003e string 'index.html' (length=10)\n\t      'type'        =\u003e string 'link' (length=4)\n\t      'target'      =\u003e string '/var/www/shared/index.html' (length=26)\n\n\t'file#www/README' =\u003e\n\t    array (size=10)\n\t      'permissions' =\u003e string '-rw----r--' (length=10)\n\t      'number'      =\u003e string '1' (length=1)\n\t      'owner'       =\u003e string '32385' (length=5)\n\t      'group'       =\u003e string 'users' (length=5)\n\t      'size'        =\u003e string '0' (length=1)\n\t      'month'       =\u003e string 'Nov' (length=3)\n\t      'day'         =\u003e string '24' (length=2)\n\t      'time'        =\u003e string '17:25' (length=5)\n\t      'name'        =\u003e string 'README' (length=6)\n\t      'type'        =\u003e string 'file' (length=4)\n\n\nAll FTP PHP functions are supported and some improved :\n\n```php\n// Requests execution of a command on the FTP server\n$ftp-\u003eexec($command);\n\n// Turns passive mode on or off\n$ftp-\u003epasv(true);\n\n// Set permissions on a file via FTP\n$ftp-\u003echmod('0777', 'file.php');\n\n// Removes a directory\n$ftp-\u003edeleteFile('path/of/directory/to/remove');\n\n// Removes a directory (recursive)\n$ftp-\u003edeleteDirectory('path/of/directory/to/remove', true);\n\n// Creates a directory\n$ftp-\u003ecreateDirectory('path/of/directory/to/create');\n\n// Creates a directory (recursive),\n// creates automaticaly the sub directory if not exist\n$ftp-\u003ecreateDirectory('path/of/directory/to/create', true);\n\n// and more ...\n```\n\nGet the help information of remote FTP server:\n\n```php\nvar_dump($ftp-\u003ehelp());\n```\n\nResult :\n\n\tarray (size=6)\n\t  0 =\u003e string '214-The following SITE commands are recognized' (length=46)\n\t  1 =\u003e string ' ALIAS' (length=6)\n\t  2 =\u003e string ' CHMOD' (length=6)\n\t  3 =\u003e string ' IDLE' (length=5)\n\t  4 =\u003e string ' UTIME' (length=6)\n\t  5 =\u003e string '214 Pure-FTPd - http://pureftpd.org/' (length=36)\n\n\n_Note : The result depend of FTP server._\n\n\n### Extendable\n\nCreate your custom `FtpClient`.\n\n```php\n// MyFtpClient.php\n\n/**\n * My custom FTP Client\n * @inheritDoc\n */\nclass MyFtpClient extends \\FtpClient\\FtpClient {\n\n  public function removeByTime($path, $timestamp) {\n      // your code here\n  }\n\n  public function search($regex) {\n      // your code here\n  }\n}\n```\n\n```php\n// example.php\n$ftp = new MyFtpClient();\n$ftp-\u003econnect($host);\n$ftp-\u003elogin($login, $password);\n\n// remove the old files\n$ftp-\u003eremoveByTime('/www/mysite.com/demo', time() - 86400));\n\n// search PNG files\n$ftp-\u003esearch('/(.*)\\.png$/i');\n```\n\n\n## Testing\n\nUsing PHPUnit tests\n\n\n## License\n\nMIT (c) 2016.\n\n## Based on code by  Nicolab\nhttps://github.com/Nicolab/php-ftp-client","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskipperbent%2Fftp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskipperbent%2Fftp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskipperbent%2Fftp-client/lists"}