Home  >  Article  >  PHP Framework  >  How to configure Laravel to use Qiniu Cloud

How to configure Laravel to use Qiniu Cloud

藏色散人
藏色散人forward
2020-04-05 09:03:053453browse

Introduction

Just in time, I configured it from scratch and recorded it below.

Recommended: laravel tutorial

Qiniu Cloud Configuration

Qiniu’s documentation is very detailed, so I only include Just go to the official document link

1. Object storage (https://developer.qiniu.com/kodo), create a new storage space

2. Fusion CDN (https:// developer.qiniu.com/fusion), configure the domain name

3. After configuring the domain name in the previous step, you need to go to your domain name provider to bind it. It is also written in the Qiniu Cloud documentation

Install the extension package and configure

Follow the documentation

composer require "overtrue/laravel-filesystem-qiniu"
config/app.php 中在 providers 添加 Overtrue\LaravelFilesystem\Qiniu\QiniuStorageServiceProvider::class,
config/filesystems.php 中在 disks 添加
'qiniu' => [
    'driver'     => 'qiniu',
    'access_key' => env('QINIU_ACCESS_KEY', 'xxxxxxxxxxxxxxxx'),
    'secret_key' => env('QINIU_SECRET_KEY', 'xxxxxxxxxxxxxxxx'),
    'bucket'     => env('QINIU_BUCKET', 'test'),
    'domain'     => env('QINIU_DOMAIN', 'xxx.clouddn.com'), // or host: https://xxxx.clouddn.com
],

Then configure the corresponding values ​​in .env.

The access_key and secret_key are in Qiniu Cloud's personal center, bucket is the name of the storage space, and domain is the custom domain name configured in Fusion CDN

Conclusion

It is very simple to use, just refer to the documentation.

Because I used laravel-admin, and modified config/admin.php as follows

How to configure Laravel to use Qiniu Cloud

The above is the detailed content of How to configure Laravel to use Qiniu Cloud. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete