PHPackages                             yanwu/phpspider - 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. [Framework](/categories/framework)
4. /
5. yanwu/phpspider

ActiveLibrary[Framework](/categories/framework)

yanwu/phpspider
===============

The PHPSpider Framework.

0190↓50%PHP

Since Dec 13Pushed 3y agoCompare

[ Source](https://github.com/yanwuxufeng/phpspider)[ Packagist](https://packagist.org/packages/yanwu/phpspider)[ RSS](/packages/yanwu-phpspider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

phpspider -- PHP蜘蛛爬虫框架
======================

[](#phpspider----php蜘蛛爬虫框架)

《我用爬虫一天时间“偷了”知乎一百万用户，只为证明PHP是世界上最好的语言 》所使用的程序

phpspider是一个爬虫开发框架。使用本框架，你不用了解爬虫的底层技术实现，爬虫被网站屏蔽、有些网站需要登录或验证码识别才能爬取等问题。简单几行PHP代码，就可以创建自己的爬虫，利用框架封装的多进程Worker类库，代码更简洁，执行效率更高速度更快。

demo目录下有一些特定网站的爬取规则，只要你安装了PHP环境，代码就可以在命令行下直接跑。 对爬虫感兴趣的开发者可以加QQ群一起讨论：147824717。

下面以糗事百科为例, 来看一下我们的爬虫长什么样子:

```
$configs = array(
    'name' => '糗事百科',
    'domains' => array(
        'qiushibaike.com',
        'www.qiushibaike.com'
    ),
    'scan_urls' => array(
        'http://www.qiushibaike.com/'
    ),
    'content_url_regexes' => array(
        "http://www.qiushibaike.com/article/\d+"
    ),
    'list_url_regexes' => array(
        "http://www.qiushibaike.com/8hr/page/\d+\?s=\d+"
    ),
    'fields' => array(
        array(
            // 抽取内容页的文章内容
            'name' => "article_content",
            'selector' => "//*[@id='single-next-link']",
            'required' => true
        ),
        array(
            // 抽取内容页的文章作者
            'name' => "article_author",
            'selector' => "//div[contains(@class,'author')]//h2",
            'required' => true
        ),
    ),
);
$spider = new phpspider($configs);
$spider->start();

```

爬虫的整体框架就是这样, 首先定义了一个$configs数组, 里面设置了待爬网站的一些信息, 然后通过调用`$spider = new phpspider($configs);`和`$spider->start();`来配置并启动爬虫.

#### 运行界面如下:

[](#运行界面如下)

[![](https://camo.githubusercontent.com/34489ee7a4e8a6b46e79cc41351e9a2de2a944e7cc2143e92f685752ed73cf28/687474703a2f2f7777772e65706f6f6c6c2e636f6d2f7a686968752f706163686f6e672e676966)](https://camo.githubusercontent.com/34489ee7a4e8a6b46e79cc41351e9a2de2a944e7cc2143e92f685752ed73cf28/687474703a2f2f7777772e65706f6f6c6c2e636f6d2f7a686968752f706163686f6e672e676966)

更多详细内容，移步到：

[开发文档](http://doc.phpspider.org)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![owner888](https://avatars.githubusercontent.com/u/4317332?v=4)](https://github.com/owner888 "owner888 (240 commits)")[![suppernice](https://avatars.githubusercontent.com/u/188820197?v=4)](https://github.com/suppernice "suppernice (7 commits)")[![awebc](https://avatars.githubusercontent.com/u/9549821?v=4)](https://github.com/awebc "awebc (1 commits)")[![kayw-geek](https://avatars.githubusercontent.com/u/29700073?v=4)](https://github.com/kayw-geek "kayw-geek (1 commits)")

### Embed Badge

![Health badge](/badges/yanwu-phpspider/health.svg)

```
[![Health](https://phpackages.com/badges/yanwu-phpspider/health.svg)](https://phpackages.com/packages/yanwu-phpspider)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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