Qiniu SDK - Simplifying the cloud storage access

Install

You can install Qiniu SDK in two ways:
1. Composer Installation
Run the following command in the root folder
composer require "overtrue/qiniu"

2. Manual Installation
require "src/Qiniu/HttpClient.php";
require "src/Qiniu/Qiniu.php";

Usage

First, you need to import the name space:
use \Overtrue\Qiniu\Qiniu;

Then config the options
$options = 'access_key' => 'your access_key',
'secret_key' => 'your secret_key',
'bucket' => 'mystorage', // bucket name
'domain' => 'mystorage.qiniudn.com', //bucket domain
'timeout' => 3600,
'is_private' => false,
;

$qiniu = Qiniu::make($options);
You can get the accesskey and secretkey from https://portal.qiniu.com/setting/key

Upload files

Syntax: $qiniu->upload(local path)
ex:
$result = $qiniu->upload(DIR . '/hello.jpg', 'hello.jpg');