Skip to content
This is a Flysystem adapter for the Aliyun OSS
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.php_cs
.styleci.yml
CHANGELOG.md
LICENSE.md
README.md
_config.yml
_ide_helper.php
composer.json
phpunit.xml.dist

README.md

Flysystem Adapter for Aliyun OSS.

This is a Flysystem adapter for the Aliyun OSS ~2.2.1

inspire by aobozhang/aliyun-oss-adapter

Installation

composer require apollopy/flysystem-aliyun-oss

for Laravel

This service provider must be registered.

// config/app.php

'providers' => [
    '...',
    ApolloPY\Flysystem\AliyunOss\AliyunOssServiceProvider::class,
];

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
],

change default to oss

    'default' => 'oss'

Use

see Laravel wiki

Plugins

inspire by itbdw/laravel-storage-qiniu

Storage::disk('oss')->putFile($md5_path, '/local_file_path/1.png', ['mimetype' => 'image/png','filename' => 'filename_by_down.png']);

Storage::disk('oss')->signedDownloadUrl($path, 3600, 'oss-cn-beijing.aliyuncs.com', true);

IDE Helper

if installed barryvdh/laravel-ide-helper

edit the config file: config/ide-helper.php

'interfaces'      => [
    '\Illuminate\Contracts\Filesystem\Filesystem' => ApolloPY\Flysystem\AliyunOss\FilesystemAdapter::class,
],
You can’t perform that action at this time.