2017 © Pedro Peláez
 

library php-ftp-client

FTP library for PHP 5.3 or later.

image

suin/php-ftp-client

FTP library for PHP 5.3 or later.

  • Monday, November 30, 2015
  • by suin
  • Repository
  • 4 Watchers
  • 26 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 9 Forks
  • 6 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

FTP Client Library for PHP

Features

  • Works without the ftp extension.
  • Minimum and simple.
  • Unit tested.

Requirements

  • PHP 5.2.0 or later

Install

Just copy Source/Suin to vendors directory in your project., (*1)

How to Use

<?php
try
{
    $client = new Suin_FTPClient_FTPClient('127.0.0.1');

    if ( $client->login('suin', 'password') === false )
    {
        echo 'Cannot login!';
    }

    if ( $client->upload('foo.php', 'foo.php', Suin_FTPClient_FTPClient::MODE_BINARY) === false )
    {
        echo 'Failed to upload!';
    }

    $client->disconnect();
}
catch ( Exception $e )
{
    echo $e;
}

More detail, please see Suin_FTPClient_FTPClientInterface., (*2)

Observer for debugging

For logging the TCP messages, you can assing an observer object to FTPClient object. The observer object must implement Suin_FTPClient_ObserverInterface., (*3)

<?php
class MyObserver implements Suin_FTPClient_ObserverInterface
{
    public function updateWithRequest($request)
    {
        echo 'PUT > '.$request;
    }

    public function updateWithResponse($message, $code)
    {
        echo 'GET < '.$message;
    }
}

$myObserver = new MyObserver();
$client = new Suin_FTPClient_FTPClient('127.0.0.1');
$client->setObserver($myObserver);

Testing

  • Needs PHPUnit 3.6
  • Needs PHP 5.3 or later

Prepare for test

cd Tests
cp FTPConfig.sample.php FTPConfig.php

And then, edit FTPConfig.php!, (*4)

How to run test

cd Tests
phpunit

The Versions

30/11 2015

dev-master

9999999-dev https://github.com/suin/php-ftp-client

FTP library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Hidehito Nozawa aka Suin

php ftp

30/11 2015

1.0.0

1.0.0.0 https://github.com/suin/php-ftp-client

FTP library for PHP 5.3 or later.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Hidehito Nozawa aka Suin

php ftp