beyondexp/beyondcdn

Flysystem 适配器用于 BeyondCDN。

dev-main 2023-03-06 11:01 UTC

This package is auto-updated.

Last update: 2024-09-06 14:10:19 UTC


README

这是一个用于 CDN (内容分发网络) 集成的 PHP Flysystem 适配器。它受到了 Frosh BunnyCDN 适配器的启发,允许您使用 Flysystem 轻松存储和检索 CDN 中的文件。

安装 您可以使用 composer 安装此适配器。在您的项目目录中运行以下命令

javascript 复制代码 composer require beyondEXP/beyondcdn 使用方式 要使用此适配器,您需要创建一个 Flysystem 实例并将适配器传递给它。以下是一个示例

use YourCompany\YourCdnAdapter\YourCdnAdapter;
use League\Flysystem\Filesystem;

$adapter = new YourCdnAdapter('your-cdn-username', 'your-cdn-api-key', 'your-cdn-zone-id');
$filesystem = new Filesystem($adapter);
Now you can use the Flysystem API to interact with your CDN. Here are some examples:
$filesystem->write('path/to/file.txt', 'contents');

// Check if a file exists on the CDN
$filesystem->has('path/to/file.txt');

// Read the contents of a file from the CDN
$contents = $filesystem->read('path/to/file.txt');

// Delete a file from the CDN
$filesystem->delete('path/to/file.txt');

配置 当创建新的适配器时,您需要传递三个参数

username: Your CDN username
apiKey: Your CDN API key
zoneId: The ID of the CDN zone you want to use

如果您想指定要使用的 CDN 域名(例如,如果您正在使用自定义域名),也可以传递一个可选的第四个参数 domain。

贡献 如果您发现了一个错误或有一个功能请求,请在 Github 仓库中为该项目创建一个问题。也欢迎 Pull requests。

许可协议 此项目受 MIT 许可证许可。有关详细信息,请参阅 LICENSE 文件。