Code Monkey home page Code Monkey logo

otter-oss's Introduction

#代码来自于 https://github.com/apollopy/flysystem-aliyun-oss

#说明

  • 本来叫:otter/oss,但otter已经有人用了。只能用neatstudio了
  • 该代码本来也就是自用

#使用方式(本地模式)

  • 将代码拷到指定目录,如根目录下 的xxx,当前文件的路径 为 xxx/oss
  • 在composer.json里加入
"repositories":[
        {
            "type":"path",
            "url":"app/Plugins/oss",
            "options":{
                "symlink":true
            }
        },
]
  • 在composer.json的require中加入
"neatstudio/otter-oss":"^1.0",
  • 执行composer update即可

###配置文件

  • 在config/filesystems.php 加入
        'oss' => [
            'driver'         => 'oss',
            'ram_arn'        => env('ALIYUN_RAM_ARN', null),
            'app_key'        => env('OSS_APP_KEY', null),
            'app_secret'     => env('OSS_APP_SECRET', null),
            'policy_expired' => env('ALIYUN_RAM_ARN_EXPIRED', 3600),
            'access_id'      => env('OSS_ACCESS_ID', 'your id'),
            'access_key'     => env('OSS_ACCESS_KEY', 'your key'),
            'bucket'         => env('OSS_BUCKET', env('OSS_PUBLIC_BUCKET','your bucket')),
            'endpoint'       => env('OSS_ENDPOINT', 'your endpoint'),
            'prefix'         => env('OSS_PREFIX', ''), // optional
            'url'            => env('OSS_PUBLIC_URL', ''),
        ],
  • 如果要默认就设置 'default'=>'oss'

.env中增加

#aliyun
ALIYUN_RAM_ARN=
#授权过期时间
ALIYUN_RAM_ARN_EXPIRED=900
ALIYUN_REGION=cn-shanghai
OSS_APP_KEY=
OSS_APP_SECRET=
OSS_REGION=oss-cn-shanghai
OSS_ENDPOINT=oss-cn-shanghai.aliyuncs.com
OSS_INTERNAL_ENDPOINT=oss-cn-shanghai-internal.aliyuncs.com

OSS_BUCKET=xx-public
OSS_PUBLIC_URL=//xx--shanghai.aliyuncs.com/

其他用法

$adapter = new AliOssAdapter($config);
$flysystem = new League\Flysystem\Filesystem($adapter);
Storage::disk('oss')->xxx()

otter-oss's People

Contributors

neatstudio avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.