https://github.com/bryanthw1020/cos-file-uploader
Laravel file upload using Tencent COS service integration
https://github.com/bryanthw1020/cos-file-uploader
laravel tencent-cloud tencent-cos-service
Last synced: 5 months ago
JSON representation
Laravel file upload using Tencent COS service integration
- Host: GitHub
- URL: https://github.com/bryanthw1020/cos-file-uploader
- Owner: bryanthw1020
- License: mit
- Created: 2019-11-28T09:52:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-02T08:59:34.000Z (over 3 years ago)
- Last Synced: 2025-05-22T08:38:05.143Z (about 1 year ago)
- Topics: laravel, tencent-cloud, tencent-cos-service
- Language: PHP
- Size: 613 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cos-file-uploader
Laravel file upload using Tencent COS service integration
## Installation
To install, run `composer require bryanthw1020/cos-file-uploader`.
After installation, run `php artisan vendor:publish` to publish the configuration file.
After publishing configuration please make sure to add this two variable into your `env` file
```
TC_COS_SECRET_ID=
TC_COS_SECRET_KEY=
```
## Usage
Below are the available method to use.
```php
# To Upload Object
CosFileUploader::uploadObject(string $bucket, string $key, string $fileName, string $base64EncodedFile, string$region = 'ap-singapore', string $schema = 'http');
## Example
CosFileUploader::uploadObject('example-bucket-123456', 'example/file/path', 'example.jpg', $base64EncodedFile);
# To Delete Single Object
CosFileUploader::deleteObject(string $bucket, string $key, string $region = 'ap-singapore', string $schema = 'http');
## Example
CosFileUploader::deleteObject('example-bucket-123456', 'example/file/path/example.jpg');
# To Delete Multiple Object
CosFileUploader::deleteObjects(string $bucket, array $keys, string $region = 'ap-singapore', string $schema = 'http');
## Example
CosFileUploader::deleteObjects('example-bucket-123456', ['example/file/path/example1.jpg', 'example/file/path/example2.jpg']);
# To Get Object URL
CosFileUploader::getObjectUrl(string $bucket, string $key, int $duration = 10, string $region = 'ap-singapore', string $schema = 'http');
## Example
CosFileUploader::getObjectUrl('example-bucket-123456', 'example/file/path/example.jpg');
```