PHPackages                             kylin987/baidu-ocr - 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. kylin987/baidu-ocr

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

kylin987/baidu-ocr
==================

百度OCR文字识别

v1.0.7(5y ago)144MITPHPPHP &gt;=5.6

Since Oct 20Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kylin987/baidu-ocr)[ Packagist](https://packagist.org/packages/kylin987/baidu-ocr)[ RSS](/packages/kylin987-baidu-ocr/feed)WikiDiscussions master Synced today

READMEChangelog (8)DependenciesVersions (9)Used By (0)

百度ocr识别sdk php的composer包
========================

[](#百度ocr识别sdk-php的composer包)

此包适用于各类支持composer的php框架

安装
--

[](#安装)

```
composer require kylin987/baidu-ocr

```

使用
--

[](#使用)

使用与官方文档一致

```
//本地图片识别
$client = new baidu\ocr\AipOcr(APP_ID, API_KEY, SECRET_KEY);
$image = file_get_contents(__DIR__ . '/test.png'); // 图片地址 (远程地址https可用这个)
$result = $client->basicGeneral($image);

```

```
//远程图片识别
$client = new baidu\ocr\AipOcr(APP_ID, API_KEY, SECRET_KEY);
$url = 'http://test.com'; // 只支持http地址(不支持https)图片地址 https可以用楼上方法
$result = $client->basicGeneral($url);

```

增加简单识别，并对结果进行简单处理 目前仅支持以下几种,后期可能再增加

```
1、idcard  身份证识别
2、bankcard 银行卡识别
3、drivingLicense 驾驶证识别
4、vehicleLicense 行驶证识别
5、licensePlate 车牌号识别
6、businessLicense 营业执照识别

```

使用方法

```
$config = [
    'app_id'  => 'app_id',
    'api_key' => 'api_key',
    'secret_key'=> 'secret_key'
];
$client = new \baidu\ocr\Ocr($config);
$image = file_get_contents($imgUrl);
$client->setSimpleResult(true);     //输出简易信息
$client->setImage($image);
$result = $client->idcard('front');

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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 ~0 days

Total

8

Last Release

2027d ago

PHP version history (3 changes)v1.0.0PHP ^5.6

v1.0.2PHP &gt;=7.0

v1.0.4PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f1c0726daff91d74835f3ef3901923fdf7b6b0b65d919968682b53edd22c9cc?d=identicon)[kylin987](/maintainers/kylin987)

### Embed Badge

![Health badge](/badges/kylin987-baidu-ocr/health.svg)

```
[![Health](https://phpackages.com/badges/kylin987-baidu-ocr/health.svg)](https://phpackages.com/packages/kylin987-baidu-ocr)
```

###  Alternatives

[qinchen/web-utils

A web application common utils

111.4k](/packages/qinchen-web-utils)

PHPackages © 2026

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