Browse Source

first commit

tags/v1.0.0^0
wlb 1 year ago
commit
13232c3048
4 changed files with 82 additions and 0 deletions
  1. +5
    -0
      .gitignore
  2. +24
    -0
      composer.json
  3. +27
    -0
      src/driver/AliOss.php
  4. +26
    -0
      src/driver/Qiniu.php

+ 5
- 0
.gitignore View File

@@ -0,0 +1,5 @@
/.idea
/.vscode
/vendor
composer.lock
.DS_Store

+ 24
- 0
composer.json View File

@@ -0,0 +1,24 @@
{
"name": "wuearl/filesystem",
"description": "for thinkphp6",
"type": "library",
"require": {
"php": ">=7.1.0",
"topthink/framework": "^6.0.0",
"xxtime/flysystem-aliyun-oss": "^1.4",
"overtrue/flysystem-qiniu": "^1.0.4"
},
"license": "MIT",
"authors": [
{
"name": "wuliangbo",
"email": "wuearl@qq.com"
}
],
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"think\\filesystem\\": "src/"
}
}
}

+ 27
- 0
src/driver/AliOss.php View File

@@ -0,0 +1,27 @@
<?php
/**
* Created by PhpStorm.
* User: wuliangbo
* Date: 2019/11/19
* Time: 09:05
*/

namespace think\filesystem\driver;

use League\Flysystem\AdapterInterface;
use think\filesystem\Driver;
use Xxtime\Flysystem\Aliyun\OssAdapter;

class AliOss extends Driver
{
protected function createAdapter(): AdapterInterface
{
return new OssAdapter([
'accessId' => $this->config['accessKey'],
'accessSecret' => $this->config['secretKey'],
'bucket' => $this->config['bucket'],
'endpoint' => $this->config['endpoint'],
'isCName' => $this->config['isCName'],
]);
}
}

+ 26
- 0
src/driver/Qiniu.php View File

@@ -0,0 +1,26 @@
<?php
/**
* @desc Created by PhpStorm
* @author: wuearl
* @since: 2019/11/23 3:53 下午
*/

namespace think\filesystem\driver;

use League\Flysystem\AdapterInterface;
use think\filesystem\Driver;
use Overtrue\Flysystem\Qiniu\QiniuAdapter;

class Qiniu extends Driver
{
protected function createAdapter(): AdapterInterface
{

return new QiniuAdapter(
$this->config['accessKey'],
$this->config['secretKey'],
$this->config['bucket'],
$this->config['domain']
);
}
}

Loading…
Cancel
Save