PHPackages                             anker1992/china-stock-data - 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. anker1992/china-stock-data

ActiveLibrary

anker1992/china-stock-data
==========================

提供国内财经门户网站股票相关数据,目前有新浪和凤凰网的数据

v1.0.1(6y ago)09MITPHP

Since Aug 15Pushed 6y agoCompare

[ Source](https://github.com/anker1992/china-stock-data)[ Packagist](https://packagist.org/packages/anker1992/china-stock-data)[ RSS](/packages/anker1992-china-stock-data/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (3)Versions (2)Used By (0)

 china-stock-data
==================

[](#-china-stock-data-)

[![Build Status](https://camo.githubusercontent.com/649c5d0edc7446bb0e107ba024797423b924c2cea6ac7085b98aee4245496a20/68747470733a2f2f7472617669732d63692e6f72672f73746162756e6b6f772f6368696e612d73746f636b2d646174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/stabunkow/china-stock-data)[![StyleCI build status](https://camo.githubusercontent.com/ddb07b473f3f2917318a4dd80d0babd0dc3b3197e288c6ddcfe2b1c3bec35f83/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139323637303631312f736869656c64)](https://camo.githubusercontent.com/ddb07b473f3f2917318a4dd80d0babd0dc3b3197e288c6ddcfe2b1c3bec35f83/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139323637303631312f736869656c64)

 提供国内财经门户网站股票相关数据，目前有新浪和凤凰网的数据

安装
--

[](#安装)

```
$ composer require anker1992/china-stock-data -vvv
```

使用
--

[](#使用)

```
use Anker1992\ChinaStockData\Sources\SinaStock;

$s = new SinaStock(); // 使用新浪股票数据源
$s->getIndex(); // 获取股指
$s->getInfo('600027'); // 获取股票信息
$s->getInfos(['600027']); // 获取批量股票信息
$s->getKlineImg('600027'); // 获取股票K线图
$s->getKlineImgWeekly('600027'); // 获取股票K线图（周）
$s->getKlineImgMonthly('600027'); // 获取股票K线图（月）
$s->getTrendImg('600027'); // 获取股票分时图

use Anker1992\ChinaStockData\Sources\IfengStock;

$s = new IfengStock(); // 使用凤凰网股票数据源
$s->getIndex(); // 获取股指
$s->getInfo('600027'); // 获取股票信息
$s->getInfos(['600027']); // 获取批量股票信息
$s->getKlineData('600027'); // 获取股票K线数据
$s->getTrendData('600027'); // 获取股票分时数据
$s->getKlineImg('600027'); // 获取股票K线图
$s->getTrendImg('600027'); // 获取股票分时图
```

注意事项
----

[](#注意事项)

code 格式为股票数字代码，若股票退市或不存在将获取不到股票信息

不同门户网的可获得的股票信息内容有所不同

### 获取股票信息示例

[](#获取股票信息示例)

```
$s = new SinaStock();
$data = $s->getInfo('600027'); // 获取股票信息
echo json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
```

显示

```
{
    "code": "600027",
    "name": "华电国际",
    "last_px": "3.79",
    "open_px": "3.82",
    "preclose_px": "3.78",
    "high_px": "3.83",
    "low_px": "3.78",
    "volume": "147511",
    "amount": "56203547",
    "px_change_rt": "0.26",
    "BV": [
        "869200",
        "1319700",
        "534600",
        "297800",
        "513900"
    ],
    "BP": [
        "3.79",
        "3.78",
        "3.77",
        "3.76",
        "3.75"
    ],
    "SV": [
        "1487400",
        "1242800",
        "853600",
        "873100",
        "664100"
    ],
    "SP": [
        "3.8",
        "3.81",
        "3.82",
        "3.83",
        "3.84"
    ],
    "time": "1560943800"
}
```

参考
--

[](#参考)

[国内股票接口](https://houjianfang.com/2018/12/05/%E8%85%BE%E8%AE%AF%E8%82%A1%E7%A5%A8%E6%8E%A5%E5%8F%A3%E3%80%81%E5%92%8C%E8%AE%AF%E7%BD%91%E8%82%A1%E7%A5%A8%E6%8E%A5%E5%8F%A3%E3%80%81%E6%96%B0%E6%B5%AA%E8%82%A1%E7%A5%A8%E6%8E%A5%E5%8F%A3%E3%80%81/)

[PHP 扩展包实战教程 - 从入门到发布](https://learnku.com/courses/creating-package/)

License
-------

[](#license)

MIT

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

2463d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cf51d2fd5f97d7a85ac41547e5b99b8a10ea603f8119e511c0154b051775f0c?d=identicon)[anker1992](/maintainers/anker1992)

---

Top Contributors

[![lizengcai888](https://avatars.githubusercontent.com/u/201916860?v=4)](https://github.com/lizengcai888 "lizengcai888 (3 commits)")

### Embed Badge

![Health badge](/badges/anker1992-china-stock-data/health.svg)

```
[![Health](https://phpackages.com/badges/anker1992-china-stock-data/health.svg)](https://phpackages.com/packages/anker1992-china-stock-data)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[laravel/browser-kit-testing

Provides backwards compatibility for BrowserKit testing in the latest Laravel release.

5139.4M286](/packages/laravel-browser-kit-testing)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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