Skip to content

Latest commit

 

History

History
43 lines (31 loc) · 1.28 KB

Viettel.md

File metadata and controls

43 lines (31 loc) · 1.28 KB

Viettel Cloud Storage

Cài đặt

Để sử dụng được dịch vụ Viettel cloud storage đầu tiên bạn cần cài đặt Flysystem adapter thông qua Composer:

composer require league/flysystem-aws-s3-v2

Cấu hình

Sau khi cài đặt xong bạn hãy mở file config/filesystems.php để cấu hình Viettel cloud storage trong mục disks:

....
'disks' => [
    ....
    'viettel' => [
        'driver' => 'viettel',
        'key' => 'Do Viettel IDC cấp',
        'secret' => 'Do Viettel IDC cấp',
        'bucket' => 'bucket của bạn'
    ],
]

Sử dụng

Sau khi đã cài đặt và cấu hình, ngay bây giờ bạn đã có thể truy cập đến Viettel cloud storage thông qua Storage facade:

use Storage;

Storage::disk('viettel')->put('file.txt', 'Contents');

Cách sử dụng các phương thức giống với storage của Laravel bạn có thể kham khảo thêm các phương thức tại đây.

Để tăng performance bạn có thể thiết lập cache cho Viettel disk như S3 Storage kham khảo cách thiết lập tại đây.