PHP code example of kechujian / aliyun-oss-sdk-laravel

1. Go to this page and download the library: Download kechujian/aliyun-oss-sdk-laravel 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/ */

    

kechujian / aliyun-oss-sdk-laravel example snippets


    'providers' => array(
        // ...
        AliyunOss\Laravel\AliyunOssServiceProvider::class,
    )
    

    'aliases' => array(
        // ...
        'OSS' => AliyunOss\Laravel\AliyunOssFacade::class,
    )
    

    Route::get('/', function()
    {
        $client = App::make('aliyun-oss');
        $client->putObject("your bucket", "your object", "content you want to upload");
        $result = $client->getObject("your bucket", "your boject");
        echo $result;
    });
    

    $app->get('/', function () use ($app) {
        $client = $app->make('aliyun-oss');
        $client->putObject('your bucket', 'your key',  "content you want to upload");
        $result = $client->getObject("your bucket", "your boject");
        echo $result;
    });
    

export OSS_ENDPOINT=''
export OSS_ACCESS_KEY_ID=''
export OSS_ACCESS_KEY_SECRET=''
export OSS_BUCKET=''