PHPackages                             icetalker/dashscope-php - 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. [API Development](/categories/api)
4. /
5. icetalker/dashscope-php

ActiveLibrary[API Development](/categories/api)

icetalker/dashscope-php
=======================

阿里云通义万相 php sdk

0.0.1(2y ago)122MITPHPPHP &gt;=7.4

Since May 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/icetalker/dashscope-php)[ Packagist](https://packagist.org/packages/icetalker/dashscope-php)[ RSS](/packages/icetalker-dashscope-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

概述
==

[](#概述)

阿里通义万相(AI 图片模型)的非官方 PHP SDK

> 注: 本包仍在完善中，未来可能会有一些不兼容的更新。后续版本可能会加入通义千问等模型功能。

安装
==

[](#安装)

通过 Composer 安装此包:

```
composer require icetalker/dashscope-php
```

用法
==

[](#用法)

用法示例
----

[](#用法示例)

示例如下：

```
use Dashscope\Dashscope;

$api_key = 'your-dashscope-api-key';

$parameters = [
    'api_key' => $api_key,
    'prompt' => 'Hello World!',
];

$response = Dashscope::imageSynthesis($parameters)->call();

echo $response->getBody()->getContents();
```

查询作业结果
------

[](#查询作业结果)

```
$api_key = 'your-dashscope-api-key';

$task_id = '******';

$response = Dashscope::fetchTask($task_id, $api_key);

echo $response->getBody()->getContents();
```

其他
--

[](#其他)

### 模型调用

[](#模型调用)

通过 `Dashscope::{模型名}()` 方法，并传入对应模型的参数，即可调用相应模型：

```
    $parameters = [
        'api_key'=>'your-dashscope-api-key',
        //...
    ];

    Dashscope::imageSynthesis($parameters)//调用模型
        ->call();
```

可调用模型包括：

- imageSynthesis: [文本生成图像](https://help.aliyun.com/zh/dashscope/developer-reference/api-details-9)
- sketchImageSynthesis: [涂鸦作画](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-doodle)
- anytext: [Anytext 图文融合](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-anytext)
- backgroundGeneration: [图像背景生成](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-generating-backgrounds)
- cosplayImageGeneration: [Cosplay 动漫人物生成](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-cosplay-image-generation)
- styleRepaintImageGeneration: [人像风格重绘](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-style-repaint)

### 参数设置

[](#参数设置)

设置参数时，所有 `input.*` 和 `parameters.*` 格式的参数都无需传入 `input.` 或 `parameters.` 前缀。所有的参数都通过数组形式传入，如下：

```
$parameters = [
    'api_key' => $api_key, // api_key 为必填项
    'prompt' => 'A cat sitting on a park bench', // 其他必填项及可选参数请参考 Dashscope 文档
    //...
];
```

可用参数列表请参考 [Dashscope 文档](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang)，如下：

- [文本生成图像](https://help.aliyun.com/zh/dashscope/developer-reference/api-details-9)
- [涂鸦作画](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-doodle)
- [Anytext 图文融合](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-anytext)
- [图像背景生成](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-generating-backgrounds)
- [Cosplay 动漫人物生成](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-api-for-cosplay-image-generation)
- [人像风格重绘](https://help.aliyun.com/zh/dashscope/developer-reference/tongyi-wanxiang-style-repaint)

### 自定义 HTTP 客户端

[](#自定义-http-客户端)

```
use GuzzleHttp\Client;

$client = new Client([
    //options ...
    'timeout' => 10,
    'proxy' => 'tcp://127.0.0.1:1080', // 使用代理
]);

$response = Dashscope::imageSynthesis($parameters)->withHttpClient($client)->call();

echo $response->getBody()->getContents();
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

746d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ea7da56e0d3dfb1a056f5504253dcf519f29c6264b10ed9709b8f649329c0dc8?d=identicon)[icetalker](/maintainers/icetalker)

---

Top Contributors

[![tubring](https://avatars.githubusercontent.com/u/46536059?v=4)](https://github.com/tubring "tubring (1 commits)")

### Embed Badge

![Health badge](/badges/icetalker-dashscope-php/health.svg)

```
[![Health](https://phpackages.com/badges/icetalker-dashscope-php/health.svg)](https://phpackages.com/packages/icetalker-dashscope-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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