PHP code example of jaychan / laravel-alioss

1. Go to this page and download the library: Download jaychan/laravel-alioss library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jaychan / laravel-alioss example snippets


  JayChan\Aliyun\OSS\ServiceProvider::class,
  

  'AliyunOSS' => JayChan\Aliyun\OSS\Facade::class,
  

// 设置Bucket
AliyunOSS::setBucket('my-bucket');
// 上传文件
AliyunOSS::uploadFile('key', $file = '/path/to/your/file', $bucket = null);
// 上传内容
AliyunOSS::uploadContent('key', $content = 'content', $bucket = null);
// 设置Bucket前缀
AliyunOSS::setBucketPrefix('prefix_');
// 获取资源请求URL
AliyunOSS::getUrl($key, $expire = 3600, $bucket = null);
shell
  php artisan vendor:publish