2017 © Pedro Peláez
 

library flysystem

Laravel 文件管理的OSS扩展

image

jiangyunan/flysystem

Laravel 文件管理的OSS扩展

  • Thursday, December 15, 2016
  • by jiangyunan
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

使用说明

目前只支持普通上传, (*1)

配置

//filesystem.php
'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => 'your-key',
            'secret' => 'your-secret',
            'region' => 'your-region',
            'bucket' => 'your-bucket',
        ],

        'oss' => [
            'driver' => 'oss',
            'accessKeyId' => 'xxxx',
            'accessKeySecret' => 'xxxx',
            'endpoint' => 'xxxx',
            'bucket' => 'xxxx'
        ]

    ],

注册服务容器

namespace App\Providers;

use Illuminate\Support\Facades\Storage;
use Illuminate\Support\ServiceProvider;
use Jiangyunan\Flysystem\Adapter\OssAdapter;
use League\Flysystem\Filesystem;
use OSS\OssClient;

class OssServiceProvider extends ServiceProvider
{
    public function boot()
    {
        Storage::extend('oss', function($app, $config){
            $client = new OssClient($config['accessKeyId'], $config['accessKeySecret'], $config['endpoint']);
            return new Filesystem(new OssAdapter($client, $config['bucket']));
        });
    }

    public function register()
    {
        //
    }
}

The Versions

15/12 2016

dev-master

9999999-dev

Laravel 文件管理的OSS扩展

  Sources   Download

MIT

The Requires

 

by Avatar jiangyunan

filesystem files storage oss filesystems