PHPackages                             johnlui/aliyun-oss-laravel7 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. johnlui/aliyun-oss-laravel7

ActiveLibrary[File &amp; Storage](/categories/file-storage)

johnlui/aliyun-oss-laravel7
===========================

阿里云 OSS 官方 SDK 的 Composer 封装，支持任何 PHP 项目，包括 Laravel、Symfony、TinyLara 等等。

v3.0.0(5y ago)347.8k↓50%5[1 issues](https://github.com/johnlui/AliyunOSS-Laravel7/issues)1MITPHPPHP &gt;=7.2.0

Since Jan 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/johnlui/AliyunOSS-Laravel7)[ Packagist](https://packagist.org/packages/johnlui/aliyun-oss-laravel7)[ Docs](https://github.com/johnlui/AliyunOSS)[ RSS](/packages/johnlui-aliyun-oss-laravel7/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (16)Used By (1)

AliyunOSS-Laravel7
------------------

[](#aliyunoss-laravel7)

```
    ___     __    _                                    ____    _____   _____
   /   |   / /   (_)   __  __  __  __   ____          / __ \  / ___/  / ___/
  / /| |  / /   / /   / / / / / / / /  / __ \        / / / /  \__ \   \__ \
 / ___ | / /   / /   / /_/ / / /_/ /  / / / /       / /_/ /  ___/ /  ___/ /
/_/  |_|/_/   /_/    \__, /  \__,_/  /_/ /_/        \____/  /____/  /____/
                    /____/

```

AliyunOSS-Laravel7 是阿里云 OSS 官方 SDK 的 Composer 封装，专供 Laravel 7 和 Laravel 8。

更新记录
----

[](#更新记录)

- 2020-06-19 `Release v3.0.0` v3 发布，专供 Laravel 7、8
- 2017-03-08 `Release v2.0.0` v2 发布，在 API 易用性上进行了大量优化
- 2016-09-12 `Release v1.3.5` 加入文件元信息的设置功能
- 2016-07-20 `Release v1.3.4` 加入文件元信息的获取功能
- 2016-01-31 `Release v1.3.2` 获取指定虚拟文件夹下的所有文件
- 2015-10-23 `Release v1.3` 增加删除、复制、移动文件功能
- 2015-08-07 `Release v1.2` 修复内存泄露 bug
- 2015-01-12 `Release v1.1` 增加内外网配置分离
- 2015-01-09 `Release v1.0` 完善功能，增加 Laravel 框架详细使用教程及代码

安装
--

[](#安装)

安装有两种方式：

### ① 直接编辑配置文件

[](#-直接编辑配置文件)

将以下内容增加到 composer.json：

```
require: {
    "johnlui/aliyun-oss-laravel7": "~3.0"
}
```

然后运行 `composer update`。

### ② 执行命令安装

[](#-执行命令安装)

运行命令：

```
composer require johnlui/aliyun-oss-laravel7:~3.0
```

使用（以 Laravel 为例）
----------------

[](#使用以-laravel-为例)

### 构建 Service 文件

[](#构建-service-文件)

新建 `app/services/OSS.php`，内容可参考：[OSS.php](https://github.com/johnlui/AliyunOSS/blob/master/example/OSS.php)，然后修改配置：

```
... ...

  private $city = '青岛';

  // 经典网络 or VPC
  private $networkType = '经典网络';

  private $AccessKeyId = '';
  private $AccessKeySecret = '';

... ...
```

### 放入自动加载

[](#放入自动加载)

无需配置，保证目录 `App/Services` 和命名空间 `namespace App\Services;` 一致即可自动加载。

### 使用

[](#使用)

```
use App\Services\OSS;

// 在外网上传一个文件并指定 options 如：Content-Type 类型
// 更多 options 见：https://github.com/johnlui/AliyunOSS/blob/master/src/oss/src/Aliyun/OSS/OSSClient.php#L142-L148
OSS::publicUpload('bucket', '目标 object 名', '本地文件绝对路径', [
    'ContentType' => 'application/pdf',
    ... ...
]);
```

更多用法等待着你去[发现](https://github.com/johnlui/AliyunOSS/blob/master/example/OSS.php)。

#### 构建 Service 文件

[](#构建-service-文件-1)

新建 `src/AppBundle/Services/OSS.php`，内容参考：[OSS.php](https://github.com/johnlui/AliyunOSS/blob/master/example/OSS.php)。

修改顶部的命名空间为 `namespace AppBundle\Services;`。

#### 放入自动加载

[](#放入自动加载-1)

无需配置。

#### 使用

[](#使用-1)

```
use AppBundle\Services\OSS;

OSS::publicUpload('bucket', '目标 object 名', '本地文件绝对路径');
```

反馈
--

[](#反馈)

有问题请到  下面留言。

License
-------

[](#license)

除 “版权所有（C）阿里云计算有限公司” 的代码文件外，遵循 [MIT license](http://opensource.org/licenses/MIT) 开源。

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 81.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~142 days

Recently: every ~299 days

Total

15

Last Release

2154d ago

Major Versions

v1.3.6 → v2.12017-03-15

v2.2.1 → v3.0.02020-06-19

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v3.0.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2127912?v=4)[吕文翰](/maintainers/JohnLui)[@johnlui](https://github.com/johnlui)

---

Top Contributors

[![johnlui](https://avatars.githubusercontent.com/u/2127912?v=4)](https://github.com/johnlui "johnlui (48 commits)")[![haogeqiu](https://avatars.githubusercontent.com/u/12930642?v=4)](https://github.com/haogeqiu "haogeqiu (2 commits)")[![ACmagic](https://avatars.githubusercontent.com/u/6644559?v=4)](https://github.com/ACmagic "ACmagic (2 commits)")[![zhukangfeng](https://avatars.githubusercontent.com/u/4588185?v=4)](https://github.com/zhukangfeng "zhukangfeng (2 commits)")[![LuMitchell](https://avatars.githubusercontent.com/u/29627681?v=4)](https://github.com/LuMitchell "LuMitchell (1 commits)")[![menthe](https://avatars.githubusercontent.com/u/1094543?v=4)](https://github.com/menthe "menthe (1 commits)")[![MrVokia](https://avatars.githubusercontent.com/u/9609834?v=4)](https://github.com/MrVokia "MrVokia (1 commits)")[![yaoshanliang](https://avatars.githubusercontent.com/u/5028569?v=4)](https://github.com/yaoshanliang "yaoshanliang (1 commits)")[![khsing](https://avatars.githubusercontent.com/u/40765?v=4)](https://github.com/khsing "khsing (1 commits)")

---

Tags

aliyunossAliyunOSS

### Embed Badge

![Health badge](/badges/johnlui-aliyun-oss-laravel7/health.svg)

```
[![Health](https://phpackages.com/badges/johnlui-aliyun-oss-laravel7/health.svg)](https://phpackages.com/packages/johnlui-aliyun-oss-laravel7)
```

###  Alternatives

[johnlui/aliyun-oss

阿里云 OSS 官方 SDK 的 Composer 封装，支持任何 PHP 项目，包括 Laravel、Symfony、TinyLara 等等。

501178.3k6](/packages/johnlui-aliyun-oss)[jacobcyl/ali-oss-storage

aliyun oss filesystem storage for laravel 5+

523566.2k7](/packages/jacobcyl-ali-oss-storage)[alphasnow/aliyun-oss-laravel

alibaba cloud object storage service for laravel

182240.7k2](/packages/alphasnow-aliyun-oss-laravel)[alphasnow/aliyun-oss-flysystem

Flysystem adapter for the Aliyun storage

14249.2k4](/packages/alphasnow-aliyun-oss-flysystem)[summergeorge/ali-oss-storage

aliyun oss filesystem storage for laravel 5+

3915.5k](/packages/summergeorge-ali-oss-storage)[yiier/yii2-aliyun-oss

Yii2 阿里云 OSS

445.3k2](/packages/yiier-yii2-aliyun-oss)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
