jacksunny/ossfs

There is no license information available for the latest version (v0.7) of this package.

aliyun oss adapter for laravel file system 5.2+

v0.7 2017-06-09 05:29 UTC

This package is not auto-updated.

Last update: 2024-11-21 08:22:03 UTC


README

laravel file system plugin based-on aliyun oss,you may use oss as normal laravel file system mode

  1. install package composer require "jacksunny/ossfs":"dev-master"

  2. append the code below to array "disks" in the file config/filesystems.php

  'oss' => [
            'driver' => 'oss',
            //using innernal network to transfer files,suggest external network for testing,internal network for running
            //'internal'=>true,
            'internal'=>false,
            'key' => env('OSS_KEY','APPKEYAPPKEYAPPK'),
            'secret' => env('OSS_SECRET','APPSECRETAPPSECRETAPPSECRETAPP'),            
            'city'=>'上海',
            'networkType'=>'经典网络',
            'bucket' => env('OSS_BUCKET','mybucketname'),
        ],
   
  1. now you may use laravel file system to put/get files on aliyun oss
    $filename = time()."";
    $content = "Contents";
    $result =  Storage::disk('oss')->put($filename, $content);
    or
    $result = Storage::disk('oss')->put($filename, $request->file('logo')->getRealPath());