c3/php-storage

dev-master 2018-03-30 06:04 UTC

README

Usage

Create storage object

$storage = StorageFactory::create(
    StorageTypeEnum::WEB_DAV(),
    'https://webdav.example.com',
    [
        'prefix' => 'basePathToWebDAV/',
        'userName' => 'user',
        'password' => 'password',
    ]
);

Stream remote file to local file system

$this->storage->download('remotePathInsideWebDAV/test.txt', 'localPath/test.txt');

Get remote file content

$content = $this->storage->downloadContent('remotePathInsideWebDAV/test.txt');

Sync remote folder structure to local filesystem (recursive)

$localFile = new \SplFileInfo('localPath/');
storage->syncRemoteToLocal('remotePathInsideWebDAVRoot/', $localFile,true);

Credits