PHPackages                             tmkook/easyhtml - 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. tmkook/easyhtml

ActiveProject

tmkook/easyhtml
===============

Automatically get HTML article list and content

1.0(4y ago)13MITPHPPHP &gt;=7.0.0

Since Oct 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/tmkook/easyhtml)[ Packagist](https://packagist.org/packages/tmkook/easyhtml)[ Docs](https://github.com/tmkook/easyhtml)[ RSS](/packages/tmkook-easyhtml/feed)WikiDiscussions main Synced 6d ago

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

About
=====

[](#about)

自动提取HTML的文章列表和文章正文 无需输入任何标签信息及正则信息 支持大部分主流博客和新闻站点

Install
-------

[](#install)

```
# tmkook/easyhtml 1.0
composer require "tmkook/easyhtml:1.0"
```

How to use
----------

[](#how-to-use)

```
//$data可以是URL或HTML
$easy = new Tmkook\EasyHTML($data);

//或者
$easy = new Tmkook\EasyHTML;
$easy->loadURL('https://example.com/news'); //加载一个URL
$easy->loadHTML($html); //或者加载一段HTML

//获取当前页面所有文章链接和分页链接
//return ['list'=>$list,'title'=>$title,'page'=>$page]
$easy->getList();

//获取当前页面文章内容，相对链接转换可使用 EasyContent
$easy->getContent();

//获取当前页面内的日期
$easy->getDate();

//获取当前页面的标题
$easy->getTitle();

//获取当前页面的favicon或LOGO
var_dump($easy->getLogo());

//获取文章内的图片，相对链接转换可使用 EasyContent
//return array
$easy->getImages();

//获取当前页面的Meta标签值，只支持 name 和 property
$easy->getMeta("description");

//获取正文DOMDocument
$easy->getContentNode();

//获页面DOMDocument
$easy->getDocumentNode();

//DOMDocument 如何使用请参考
https://www.php.net/manual/en/class.domdocument.php
```

Relative link to absolute link
------------------------------

[](#relative-link-to-absolute-link)

```
//相对链接转换绝对链接的域名
$url = 'https://example.com';

//文章正文
$content = $easy->getContent();

//开始转换
$easyContent = new Tmkook\EasyContent($url,$content);

//或者
$easyContent = new Tmkook\EasyContent;
$easyContent->setBase($url);
$easyContent->setContent($content);

//获取转换后的正文
$easyContent->getContent();

//获取文章纯文字内容，传入长度可截取简介
$easyContent->getText($length);//截取多少个字符，默认为0不截取

//获取转换后的图片链接
$easyContent->getImages($length);//获取多少个正文图片，默认为0取全部
```

case
----

[](#case)

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

1682d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

HTML Parserarticle extract

### Embed Badge

![Health badge](/badges/tmkook-easyhtml/health.svg)

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

###  Alternatives

[voku/simple_html_dom

Simple HTML DOM package.

9188.3M63](/packages/voku-simple-html-dom)

PHPackages © 2026

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