Package Data | |
---|---|
Maintainer Username: | JellyBool |
Maintainer Contact: | jellybool@outlook.com (JellyBool) |
Package Create Date: | 2017-05-04 |
Package Last Update: | 2020-03-18 |
Home Page: | https://www.codecasts.com/ |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-22 03:14:31 |
Package Statistics | |
---|---|
Total Downloads: | 28,639 |
Monthly Downloads: | 12 |
Daily Downloads: | 2 |
Total Stars: | 91 |
Total Watchers: | 4 |
Total Forks: | 26 |
Total Open Issues: | 5 |
视频使用教程(当然是免费的):https://www.laravist.com/series/awesome-laravel-packages/episodes/8
直接可以通过 composer 来安装:
$ composer require "jellybool/flysystem-upyun"
use League\Flysystem\Filesystem;
use JellyBool\Flysystem\Upyun\UpyunAdapter;
$bucket = 'your-bucket-name';
$operator = 'oparator-name';
$password = 'operator-password';
$domain = 'xxxxx.b0.upaiyun.com'; // 或者 https://xxxx.b0.upaiyun.com
$adapter = new UpyunAdapter($bucket, $operator, $password, $domain);
$flysystem = new Filesystem($adapter);
1.在 config/app.php
添加 UpyunServiceProvider
:
'providers' => [
// Other service providers...
JellyBool\Flysystem\Upyun\UpyunServiceProvider::class,
],
2.在 config/filesystems.php
的 disks
中添加下面的配置:
return [
//...
'upyun' => [
'driver' => 'upyun',
'bucket' => 'your-bucket-name',// 服务名字
'operator' => 'oparator-name', // 操作员的名字
'password' => 'operator-password', // 操作员的密码
'domain' => 'xxxxx.b0.upaiyun.com', // 服务分配的域名
'protocol' => 'https', // 服务使用的协议,如需使用 http,在此配置 http
],
//...
];
bool $flysystem->write('file.md', 'contents');
bool $flysystem->writeStream('file.md', fopen('path/to/your/local/file.jpg', 'r'));
bool $flysystem->update('file.md', 'new contents');
bool $flysystem->updateStram('file.md', fopen('path/to/your/local/file.jpg', 'r'));
bool $flysystem->rename('foo.md', 'bar.md');
bool $flysystem->copy('foo.md', 'foo2.md');
bool $flysystem->delete('file.md');
bool $flysystem->has('file.md');
string|false $flysystem->read('file.md');
array $flysystem->listContents();
array $flysystem->getMetadata('file.md');
int $flysystem->getSize('file.md');
string $flysystem->getUrl('file.md');
string $flysystem->getMimetype('file.md');
int $flysystem->getTimestamp('file.md');
MIT