PHP code example of kalax2 / laravel-huaweicloud-obs

1. Go to this page and download the library: Download kalax2/laravel-huaweicloud-obs 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/ */

    

kalax2 / laravel-huaweicloud-obs example snippets


// 在config/filesystems.php中添加相应配置
return [

    /* 其他配置 */
    
    'obs' => [
        'driver' => 'obs',
        'access_key' => env('OBS_ACCESS_KEY'),
        'access_secret' => env('OBS_ACCESS_SECRET'),
        'bucket' => env('OBS_BUCKET'),
        'region' => env('OBS_REGION'),      // 地域,详见 https://console.huaweicloud.com/apiexplorer/#/endpoint/OBS
        'ssl' => env('OBS_SSL', true),      // 是否使用https
        'domain' => env('OBS_DOMAIN', ''),  // 自定义域名
        'guzzle' => []                      // GuzzleHttp配置
    ]
];

Storage::disk('obs')->put('hello.txt', 'world');
Storage::disk('obs')->temporaryUrl('hello.txt', now()->addMinutes(5));