PHPackages                             2weima/open-api - 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. 2weima/open-api

ActiveLibrary[API Development](/categories/api)

2weima/open-api
===============

二维码解码与生成接口 2weima.com api composer

1.0.1(3y ago)222[1 issues](https://github.com/2weima/open-api/issues)MITPHPPHP &gt;=7.0

Since Nov 18Pushed 3y agoCompare

[ Source](https://github.com/2weima/open-api)[ Packagist](https://packagist.org/packages/2weima/open-api)[ Docs](https://api.2weima.com/)[ RSS](/packages/2weima-open-api/feed)WikiDiscussions main Synced today

READMEChangelog (2)DependenciesVersions (3)Used By (0)

### 概述

[](#概述)

二维工坊 - 开放接口

快速实现 【二维码解码、二维码模板美化、二维码生成】 等功能，具有AI加持，能识别微模糊和微变形的二维码，在线体验：

目前测试情况十分优秀： 测试图片，二维工坊和微信能全识别、支付宝可识别部分、其他平台几乎不能识别

- -samples
- test-1.png 超模糊问题
- test-2.png LOGO过大问题
- test-3.png 模糊变形问题
- ...

暂时仅提供少部分，已经足够大家思考和处理，是否应该自己去实现这些情况，有些问题仅使用开源程序是不能满足需求的，本接口依靠二维工坊每天处理海量二维码图片，从识别失败的图片的不同情况中训练而成。

任何语言都可以使用，非PHP语言，可以参考samples示例 主页： 接口文档：

### install

[](#install)

依赖PHP Curl 扩展

```
composer require "2weima/open-api"

```

### usage

[](#usage)

使用方法请参考 samples 目录下的示例

```
use api_2weima_com\Client as api_2weima_client;

/**
 * token 在这获取 https://www.2weima.com/user/api_tokens/index.html
 * 需要授权 ： qr:encode  qr:decode
 */

$config = array(
	'token'=> '3816|RMSuQC....uwAGenrYf', //换成你自己的token
	'is_mock'=>false, // usemock.com 测试数据
	'is_https'=>true,// 部分php curl 处理 https 时出错，可以切换到 http
	'auto_compress'=>true, //本地图片压缩后再解码，速度更快
	'compress_max_width'=>800, //图片最大宽度 ，如果你的图片很大尺寸，建议调整到合适大小进行压缩，取得更快的速度
	'compress_max_height'=>1200,//图片最大高度
	'compress_quality'=>85,//图片质量
);

$client = new api_2weima_client($config);

```

### 二维码解码

[](#二维码解码)

```

//解码
$result = $client
	->set_image('https://www.2weima.com/static/images/weixin-kefu.jpg')
	// ->set_image_local('./kefu.jpg')
	// ->set_multi('one') //one 只返回一个结果 ， multi 返回多个解码结果 （ 使用 jie12weima 同时识别条码和二维码）
	// ->set_detype('jie2weima') // 条码：jie1weima  二维码：jie2weima   条码和二维码 ：jie12weima
	->qrdecode();
var_dump($result);

// array(3) {
// 	["status"]=>int(200)
// 	["message"]=>string(7) "success"
// 	["qr_content"]=>string(44) "https://u.wechat.com/MCwqa9eki8owhpRib5J4HDE"
//   }

```

### 二维码生成

[](#二维码生成)

```

//生成
$result = $client->set_content('https://www.2weima.com/?a=b&c=g&text=中文说明%2')
	->set_shape(1)
	->set_mark_shape(2)
	->set_output('png')
	->set_footer('')
	// ->set_template_id(3230)
	->set_size(500)
	->set_margin(20)
	->set_level('H')
	->set_version(10)
	->qrencode();

var_dump($result);
// array(3) {
// 	["status"]=> int(200)
// 	["message"]=> string(7) "success"
// 	["qr_image"]=> string(78) "https://img.2weima.com/qr_text/2022/11/18/732177f7c8fba0054500c3e7dcb4dcc6.png"
//   }

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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

Every ~104 days

Total

2

Last Release

1218d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/73941933?v=4)[二维工坊](/maintainers/zbcms)[@zbcms](https://github.com/zbcms)

---

Top Contributors

[![zbcms](https://avatars.githubusercontent.com/u/73941933?v=4)](https://github.com/zbcms "zbcms (6 commits)")

### Embed Badge

![Health badge](/badges/2weima-open-api/health.svg)

```
[![Health](https://phpackages.com/badges/2weima-open-api/health.svg)](https://phpackages.com/packages/2weima-open-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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