jaychan / laravel-alioss by jaychan

阿里云OSS for Laravel
22
5
2
Package Data
Maintainer Username: jaychan
Maintainer Contact: voidea@foxmail.com (jaychan)
Package Create Date: 2015-08-05
Package Last Update: 2015-08-05
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-18 03:02:25
Package Statistics
Total Downloads: 22
Monthly Downloads: 2
Daily Downloads: 0
Total Stars: 5
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

阿里云OSS SDK for Laravel 5

安装

  1. 安装包文件
composer require jaychan/laravel-alioss
  1. 添加 ServiceProvider 到您项目 config/app.php 中的 providers 部分:
JayChan\Aliyun\OSS\ServiceProvider::class,
  1. 创建配置文件:
php artisan vendor:publish
  1. 请修改应用根目录下的 config/alioss.php 中对应的项即可;

  2. (可选)添加外观到 config/app.php 中的 aliases 部分:

'AliyunOSS' => JayChan\Aliyun\OSS\Facade::class,

使用

// 设置Bucket
AliyunOSS::setBucket('my-bucket');
// 上传文件
AliyunOSS::uploadFile('key', $file = '/path/to/your/file', $bucket = null);
// 上传内容
AliyunOSS::uploadContent('key', $content = 'content', $bucket = null);
// 设置Bucket前缀
AliyunOSS::setBucketPrefix('prefix_');
// 获取资源请求URL
AliyunOSS::getUrl($key, $expire = 3600, $bucket = null);

License

MIT