ngmy/l4-dav

Laravel 4 的简单 WebDAV 客户端库

0.5.0 2014-10-12 20:29 UTC

This package is auto-updated.

Last update: 2024-09-04 22:48:01 UTC


README

Build Status Coverage Status

Laravel 4 的简单 WebDAV 客户端库。

需求

L4Dav 的以下需求:

  • PHP 5.3+

  • Laravel 4.0+

依赖

L4Dav 的以下依赖:

安装

将包添加到您的 composer.json 文件中,并运行 composer update

{
    "require": {
        "ngmy/l4-dav": "dev-master"
    }
}

将以下内容添加到 app/config/app.php 文件中服务提供者的列表:

'Ngmy\L4Dav\L4DavServiceProvider',

将以下内容添加到 app/config/app.php 文件中类别名列表:

'L4Dav' => 'Ngmy\L4Dav\Facades\L4Dav',

配置

安装后,您可以通过运行以下命令将包的配置文件发布到您的应用程序:

php artisan config:publish ngmy/l4-dav

这会将配置文件发布到 app/config/packages/ngmy/l4-dav/config.php,您可以在那里修改包的配置。

示例

基本用法

从 WebDAV 服务器下载文件

L4Dav::get('path/to/remote/file', '/path/to/local/file');

将文件上传到 WebDAV 服务器

L4Dav::put('/path/to/local/file', 'path/to/remote/file');

在 WebDAV 服务器上删除文件

L4Dav::delete('path/to/remote/file');

在 WebDAV 服务器上复制文件

L4Dav::copy('path/to/source/file', 'path/to/dest/file');

在 WebDAV 服务器上重命名文件

L4Dav::move('path/to/source/file', 'path/to/dest/file');

在 WebDAV 服务器上创建目录

L4Dav::mkdir('path/to/remote/directory/');

检查 WebDAV 服务器上目录的存在性

L4Dav::exists('path/to/remote/directory/');

列出 WebDAV 服务器上目录的内容

L4Dav::ls('path/to/remote/directory/');

获取响应

获取状态码

$response = L4Dav::put('/path/to/local/file', 'path/to/remote/file');
$response->getStatus();

获取状态消息

$response = L4Dav::put('/path/to/local/file', 'path/to/remote/file');
$response->getMessage();

获取响应体

$response = L4Dav::put('/path/to/local/file', 'path/to/remote/file');
$response->getBody();