yangzie/aliyun-oss

1.0.0 2019-02-28 10:06 UTC

This package is not auto-updated.

Last update: 2024-06-01 12:12:49 UTC


README

This is a Flysystem adapter for the Aliyun OSS ~2.0.4

Installation

composer require apollopy/flysystem-aliyun-oss

for Laravel

edit the config file: config/filesystems.php

add config

'oss' => [
    'driver'     => 'oss',
    'access_id'  => env('OSS_ACCESS_ID','your id'),
    'access_key' => env('OSS_ACCESS_KEY','your key'),
    'bucket'     => env('OSS_BUCKET','your bucket'),
    'endpoint'   => env('OSS_ENDPOINT','your endpoint'),
    'prefix'     => env('OSS_PREFIX', ''), // optional
    'url'        => env('OSS_URL'),
],

change default to oss

    'default' => 'oss'

Use

see Laravel wiki

Plugins

inspire by https://github.com/apollopy/flysystem-aliyun-oss

Storage::disk('oss')->putFile($path, '/local_file_path/1.png', ['mimetype' => 'image/png']);
Storage::disk('oss')->signedDownloadUrl($path, 3600, 'oss-cn-beijing.aliyuncs.com', true);
Storage::disk('oss')->url($path);