PHPackages                             larva/laravel-aliyun - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. larva/laravel-aliyun

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

larva/laravel-aliyun
====================

This is a Laravel expansion for the Aliyun.

2.2.0(2y ago)01.4kMITPHP

Since Feb 22Pushed 3w agoCompare

[ Source](https://github.com/larvatecn/laravel-aliyun)[ Packagist](https://packagist.org/packages/larva/laravel-aliyun)[ RSS](/packages/larva-laravel-aliyun/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (0)

Laravel Aliyun
==============

[](#laravel-aliyun)

This is a Aliyun expansion for the Laravel.

[![License](https://camo.githubusercontent.com/3993cb9cd57f15e163bef7ec5d39c2caadcfe3de3fb7bc31320aeb14527e177a/68747470733a2f2f706f7365722e707567782e6f72672f6c617276612f6c61726176656c2d616c6979756e2f6c6963656e73652e737667)](https://packagist.org/packages/larva/laravel-aliyun)[![Latest Stable Version](https://camo.githubusercontent.com/5f8cfbe59b3c76f95892c1bb15980f807a7c691be0971b432b04155fb1c83201/68747470733a2f2f706f7365722e707567782e6f72672f6c617276612f6c61726176656c2d616c6979756e2f762f737461626c652e706e67)](https://packagist.org/packages/larva/laravel-aliyun)[![Total Downloads](https://camo.githubusercontent.com/ebf5ca7e602aeac503417010a1c5e5b16a9b10a8f80a829787b0819a964c20d7/68747470733a2f2f706f7365722e707567782e6f72672f6c617276612f6c61726176656c2d616c6979756e2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/larva/laravel-aliyun)

环境需求
----

[](#环境需求)

- PHP &gt;= 8.2
- Laravel &gt;= 12.0

安装
--

[](#安装)

```
composer require larva/laravel-aliyun -vv
```

配置
--

[](#配置)

### 1. 发布配置文件

[](#1-发布配置文件)

```
php artisan vendor:publish --tag="aliyun-config"
```

发布后配置文件位于 `config/aliyun.php`。

### 2. 环境变量

[](#2-环境变量)

在 `.env` 文件中配置阿里云访问凭证：

```
ALIBABA_CLOUD_ACCESS_KEY_ID=your-access-key-id
ALIBABA_CLOUD_ACCESS_KEY_SECRET=your-access-key-secret
```

### 3. 多账号配置

[](#3-多账号配置)

`config/aliyun.php` 支持配置多个阿里云账号，`default` 为默认账号，其余账号会与默认配置合并：

```
return [
    'default' => [
        'type' => 'access_key',
        'region' => 'cn-beijing',
        'access_id' => env('ALIBABA_CLOUD_ACCESS_KEY_ID'),
        'access_key' => env('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
        'connect_timeout' => 5,
        'timeout' => 10,
        'proxy' => null,
    ],

    // 额外账号（配置会与 default 合并）
    'secondary' => [
        'type' => 'access_key',
        'access_id' => env('ALIYUN_SECONDARY_ACCESS_KEY_ID'),
        'access_key' => env('ALIYUN_SECONDARY_ACCESS_KEY_SECRET'),
        'region' => 'cn-shanghai',
    ],
];
```

### 4. 认证方式

[](#4-认证方式)

支持四种阿里云认证方式，通过 `type` 字段切换：

type说明必需参数`access_key`AccessKey 认证（默认）`access_id`, `access_key``ecs_ram_role`ECS RAM 角色认证`role_name``ram_role_arn`RAM Role ARN 认证`access_id`, `access_key`, `role_arn`, `role_session_name``rsa_key_pair`RSA 密钥对认证`public_key_id`, `private_key_file`功能
--

[](#功能)

### 短信服务（SMS）

[](#短信服务sms)

```
use Larva\Aliyun\AliyunHelper;

// 发送短信
AliyunHelper::sendSms(
    phoneNumbers: '13800138000',           // string|array 手机号
    templateCode: 'SMS_123456789',         // 模板Code
    templateParam: ['code' => '1234'],     // array|string 模板参数
    signName: '阿里云',                    // 签名
    smsUpExtendCode: null,                 // 选填，上行短信扩展码
    outId: null,                           // 选填，外部流水号
);
```

### CDN 服务

[](#cdn-服务)

```
use Larva\Aliyun\Jobs\Cdn\PushObjectCacheJob;
use Larva\Aliyun\Jobs\Cdn\RefreshObjectCachesJob;

// 预热缓存（将源站内容预热到 L2 缓存节点）
PushObjectCacheJob::dispatch(['https://example.com/page1', 'https://example.com/page2'], 'domestic');
// $area: domestic（国内）| overseas（海外）

// 刷新缓存
RefreshObjectCachesJob::dispatch('https://example.com/page1', 'File');
// $objectType: File（文件）| Directory（目录）
```

### DNS 服务（Alidns）

[](#dns-服务alidns)

```
use Larva\Aliyun\Jobs\Dns\DeleteDomainRecord;
use Larva\Aliyun\Jobs\Dns\DeleteSubDomainRecordsJob;
use Larva\Aliyun\Jobs\Dns\UpdateDomainRecordJob;

// 删除解析记录
DeleteDomainRecord::dispatch('recordId');

// 删除主机记录的所有解析
DeleteSubDomainRecordsJob::dispatch('example.com', 'www');

// 修改解析记录
UpdateDomainRecordJob::dispatch(
    recordId: 'recordId',
    rr: 'www',
    type: 'A',
    value: '192.168.1.1',
    ttl: 600,         // 选填，默认 600
    line: 'default',  // 选填，默认 default
);
```

### 直播服务（Live）

[](#直播服务live)

```
use Larva\Aliyun\LiveHelper;
use Larva\Aliyun\Jobs\Live\StreamsNotifySetJob;
use Larva\Aliyun\Jobs\Live\StreamNotifyDeleteJob;

// 设置直播推流回调（同步）
LiveHelper::setLiveStreamsNotifyUrlConfig('push.example.com', 'https://example.com/callback');

// 删除流回调配置（同步）
LiveHelper::deleteLiveStreamsNotifyUrlConfig('push.example.com');

// 禁止推流（同步）
LiveHelper::forbidLiveStream('app', 'push.example.com', 'streamName');

// 恢复推流（同步）
LiveHelper::resumeLiveStream('app', 'push.example.com', 'streamName');

// 设置直播推流回调（异步队列）
StreamsNotifySetJob::dispatch('push.example.com', 'https://example.com/callback');

// 删除流回调配置（异步队列）
StreamNotifyDeleteJob::dispatch('push.example.com');
```

### 宽带提速服务

[](#宽带提速服务)

```
use Larva\Aliyun\AliyunHelper;

// 宽带提速预检查
AliyunHelper::SnsuBandPreCheck('192.168.1.1', 80);
```

队列任务
----

[](#队列任务)

所有 Job 默认实现 `ShouldQueue`，通过 `dispatch()` 方法分发到队列异步执行。可通过 Job 类的 `$tries` 属性控制重试次数：

Job默认重试次数`PushObjectCacheJob`默认`RefreshObjectCachesJob`3`DeleteDomainRecord`默认`DeleteSubDomainRecordsJob`默认`UpdateDomainRecordJob`2`SendSmsJob`2`StreamsNotifySetJob`默认`StreamNotifyDeleteJob`默认License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance62

Regular maintenance activity

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% 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 ~134 days

Recently: every ~226 days

Total

10

Last Release

788d ago

Major Versions

1.0.2 → 2.0.02021-10-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/534cdb651e8c806590fa945c6b5a18f361613848e890db1349f4a9fbcae1a650?d=identicon)[xutongle](/maintainers/xutongle)

---

Top Contributors

[![xutongle](https://avatars.githubusercontent.com/u/46956076?v=4)](https://github.com/xutongle "xutongle (16 commits)")[![xutl](https://avatars.githubusercontent.com/u/20939388?v=4)](https://github.com/xutl "xutl (3 commits)")

---

Tags

aliyunlaravelphplaravelaliyunLarva

### Embed Badge

![Health badge](/badges/larva-laravel-aliyun/health.svg)

```
[![Health](https://phpackages.com/badges/larva-laravel-aliyun/health.svg)](https://phpackages.com/packages/larva-laravel-aliyun)
```

###  Alternatives

[illuminate/broadcasting

The Illuminate Broadcasting package.

7127.4M234](/packages/illuminate-broadcasting)[laravel/scout

Laravel Scout provides a driver based solution to searching your Eloquent models.

1.7k57.2M679](/packages/laravel-scout)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k99.8M350](/packages/laravel-horizon)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.2M126](/packages/nuwave-lighthouse)[illuminate/notifications

The Illuminate Notifications package.

483.1M1.2k](/packages/illuminate-notifications)[illuminate/events

The Illuminate Events package.

13558.0M2.3k](/packages/illuminate-events)

PHPackages © 2026

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