PHP code example of panwenbin / yii2-aliyunoss

1. Go to this page and download the library: Download panwenbin/yii2-aliyunoss 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/ */

    

panwenbin / yii2-aliyunoss example snippets


return [
    'components' => [
        'oss' => [
            'class' => 'panwenbin\yii2\aliyunoss\OssBucket',
            'endPoint' => 'oss-cn-shanghai.aliyuncs.com',
            'accessKeyId' => 'abcdefghijklmn',
            'accessKeySecret' => '1234567890',
            'bucket' => 'panwenbin',
            'cname' => 'oss.panwenbin.com',
        ],
    ],
];

$oss = Yii::$app->get('oss');
$isSuccess = $oss->putObject('somefile.txt', 'This is a test file!');