PHPackages                             her-cat/v2ex-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. her-cat/v2ex-api

ActiveLibrary

her-cat/v2ex-api
================

基于 V2EX API 的 PHP 组件

1.0.0(6y ago)38MITPHP

Since Jun 16Pushed 6y agoCompare

[ Source](https://github.com/her-cat/v2ex-api)[ Packagist](https://packagist.org/packages/her-cat/v2ex-api)[ RSS](/packages/her-cat-v2ex-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

 v2ex-api
==========

[](#-v2ex-api-)

 🌴 基于 V2EX API 的 PHP 组件.

[![Build Status](https://camo.githubusercontent.com/e8afc3ef1b25dff44488dfe91a6d963273f7a721be884e31bd50cbcd0190e6e5/68747470733a2f2f7472617669732d63692e6f72672f6865722d6361742f763265782d6170692e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/her-cat/v2ex-api)[![StyleCI build status](https://camo.githubusercontent.com/d98f1ad6cec66f3fabf1d11c09fa19871c6cd922b51819492a1bf66c04df284a/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139323035303838332f736869656c64)](https://github.styleci.io/repos/192050883)[![GitHub](https://camo.githubusercontent.com/085ab9edcef4c7baa6f5b2b7c2860db4b5e56058b948227427589c80c0bb1d72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6865722d6361742f763265782d6170692e737667)](https://camo.githubusercontent.com/085ab9edcef4c7baa6f5b2b7c2860db4b5e56058b948227427589c80c0bb1d72/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6865722d6361742f763265782d6170692e737667)

安装
--

[](#安装)

```
$ composer require her-cat/v2ex-api -vvv
```

使用
--

[](#使用)

```
use HerCat\V2exApi\V2exApi;

$v2ex = new V2exApi();
```

### 获取最热主题

[](#获取最热主题)

```
$response = $v2ex->getHotTopics();
```

示例：

```
[
    {
        "node":{
            "avatar_large":"//cdn.v2ex.com/navatar/6e27/13a6/557_large.png?m=1473710080",
            "name":"life",
            "avatar_normal":"//cdn.v2ex.com/navatar/6e27/13a6/557_normal.png?m=1473710080",
            "title":"生活",
            "url":"https://www.v2ex.com/go/life",
            "topics":1291,
            "footer":null,
            "header":null,
            "title_alternative":"Life",
            "avatar_mini":"//cdn.v2ex.com/navatar/6e27/13a6/557_mini.png?m=1473710080",
            "stars":288,
            "root":false,
            "id":557,
            "parent_node_name":null
        },
        "member":{
            "username":"fyy5520",
            "website":"",
            "github":"",
            "psn":"",
            "avatar_normal":"//cdn.v2ex.com/gravatar/1e435c2a43b5af7191f09d401440e982?s=24&d=retro",
            "bio":"",
            "url":"https://www.v2ex.com/u/fyy5520",
            "tagline":"",
            "twitter":"",
            "created":1514864265,
            "avatar_large":"//cdn.v2ex.com/gravatar/1e435c2a43b5af7191f09d401440e982?s=24&d=retro",
            "avatar_mini":"//cdn.v2ex.com/gravatar/1e435c2a43b5af7191f09d401440e982?s=24&d=retro",
            "location":"",
            "btc":"",
            "id":278484
        },
        "last_reply_by":"PP",
        "last_touched":1560682334,
        "title":"30 岁大龄剩女日常吐槽",
        "url":"https://www.v2ex.com/t/574429",
        "created":1560665172,
        "content":"最近看到好多关于抨击大龄剩女的问题，",
        "content_rendered":"最近看到好多关于抨击大龄剩女的问题，简直要生食其肉一般，也不知道为什么对这种群体有这么大恶意。",
        "last_modified":1560665172,
        "replies":88,
        "id":574429
    }
]
```

### 获取最新主题

[](#获取最新主题)

```
$response = $v2ex->getLatestTopics();
```

示例：

> 返回结果跟 `获取最热主题` 一样

### 获取节点信息

[](#获取节点信息)

```
$response = $v2ex->getNode('python');
```

示例：

```
{
    "avatar_large":"//cdn.v2ex.com/navatar/8613/985e/90_large.png?m=1560497984",
    "name":"python",
    "avatar_normal":"//cdn.v2ex.com/navatar/8613/985e/90_normal.png?m=1560497984",
    "title":"Python",
    "url":"https://www.v2ex.com/go/python",
    "topics":11624,
    "footer":"",
    "header":"这里讨论各种 Python 语言编程话题，也包括 Django，Tornado 等框架的讨论。这里是一个能够帮助你解决实际问题的地方。",
    "title_alternative":"Python",
    "avatar_mini":"//cdn.v2ex.com/navatar/8613/985e/90_mini.png?m=1560497984",
    "stars":8055,
    "root":false,
    "id":90,
    "parent_node_name":"programming"
}
```

### 获取用户信息

[](#获取用户信息)

根据用户名获取用户信息

```
$response = $v2ex->getMemberByUsername('hercat');
```

根据用户 ID 获取用户信息

```
$response = $v2ex->getMemberByID(336714);
```

示例：

```
{
    "username":"hercat",
    "website":null,
    "github":null,
    "psn":null,
    "avatar_normal":"//cdn.v2ex.com/gravatar/16a382effadf6405b4f2923be83e8d04?s=24&d=retro",
    "bio":null,
    "url":"https://www.v2ex.com/u/hercat",
    "tagline":null,
    "twitter":null,
    "created":1532747204,
    "status":"found",
    "avatar_large":"//cdn.v2ex.com/gravatar/16a382effadf6405b4f2923be83e8d04?s=24&d=retro",
    "avatar_mini":"//cdn.v2ex.com/gravatar/16a382effadf6405b4f2923be83e8d04?s=24&d=retro",
    "location":null,
    "btc":null,
    "id":336714
}
```

### 获取原始返回结果

[](#获取原始返回结果)

方法最后一个参数为是否格式化结果，`bool` 类型 ：

```
$response = $v2ex->getMemberByUsername('hercat', false);
```

### 参数说明

[](#参数说明)

```
array|string getHotTopics(bool $format = true)
array|string getLatestTopics(bool $format = true)
array|string getNode(string $name, bool $format = true)
array|string getMemberByUsername(string $username, bool $format = true)
array|string getMemberByID(int $id, bool $format = true)
```

> - $name - 节点名称，比如：“python”；
> - $username - 用户名称，比如：“hercat”；
> - $id - 用户 ID，比如：“336714”；
> - $format - 是否格式化返回结果。

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

2

Last Release

2517d ago

Major Versions

0.0.1 → 1.0.02019-06-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/049bfbc238eea2f9e06ea9fcaaf526c64065fb74583b91ba547e6d9b23c390e0?d=identicon)[her-cat](/maintainers/her-cat)

---

Top Contributors

[![her-cat](https://avatars.githubusercontent.com/u/18332628?v=4)](https://github.com/her-cat "her-cat (37 commits)")

---

Tags

php-packagev2ex-api

### Embed Badge

![Health badge](/badges/her-cat-v2ex-api/health.svg)

```
[![Health](https://phpackages.com/badges/her-cat-v2ex-api/health.svg)](https://phpackages.com/packages/her-cat-v2ex-api)
```

###  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)
