PHPackages                             phleech/phcomments - 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. phleech/phcomments

ActiveLibrary

phleech/phcomments
==================

Retrieve video comments from PornHub

v1.0.2(2y ago)1231[2 PRs](https://github.com/phleech/phcomments/pulls)MITPHPPHP &gt;=8.1

Since Apr 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/phleech/phcomments)[ Packagist](https://packagist.org/packages/phleech/phcomments)[ RSS](/packages/phleech-phcomments/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

About
-----

[](#about)

A basic lightweight comment scraper for PornHub videos.

Install (Requires PHP 8.1+)
---------------------------

[](#install-requires-php-81)

The recommended way to install PHComments is through Composer.

```
composer require phleech/phcomments
```

Usage
-----

[](#usage)

### Example

[](#example)

```
use PHComments\Parser;

$parser = new Parser();
$comments = $parser->randomVideo()->getComments();

// $comments = [
//    {"body":"Identity theft is not a joke, Jim!","timestamp":"9 years ago","author":"TightyDwighty","votes":"4"},
//    {"body":"Name?","timestamp":"8 months ago","author":"RandyStarbucks","votes":"0"}
// ];
```

### Page selection

[](#page-selection)

The `Parser` class exposes a `setPageUrl()` method used to specify a PornHub resource to scrape.

```
$parser->setPageUrl(url: 'view_video.php?viewkey=123456789');

// results in the following page being scraped:
// https://www.pornhub.com/view_video.php?viewkey=123456789.
```

> The default base path of `https://www.pornhub.com` is used with all requests and must not be present in the URL used in `setPageUrl()`.

There are two additional helper methods available which can be used to increase code readability:

`randomVideo()` is an alias of `setPageUrl('/video/random')`.

`setViewKey(viewKey: 'abcdef')` is an alias of `setPageUrl('view_video.php?viewkey=abcdef')`.

### Optional configuration

[](#optional-configuration)

Any comments scraped are subject to a filter to remove those with a larger than specified author or body.

These restrictions are set in `Comment::DEFAULT_MAX_BODY_LENGTH` and `Comment::DEFAULT_MAX_AUTHOR_LENGTH`.

If you wish to use a different value for either/both of these restrictions then simply provide them when creating the `Parser` class.

```
use PHComments\Parser;

$parser = new Parser(
    maxCommentBodyLength: 250
    maxCommentAuthorLength: 100
);

// results in any comments with a body greater than 250 chars
// or an author greater than 100 chars being removed.
```

> These parameters are public on the `Parser` class and can be retrieved.

Tests
-----

[](#tests)

The package has 100% code coverage.

To run the test suite run

```
./run-tests.sh
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Every ~70 days

Total

3

Last Release

986d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ae74eac42fd8fe184c6f6605857c28eb863663184d251096fc4326bfea53db8?d=identicon)[phleech](/maintainers/phleech)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/phleech-phcomments/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2021.0M277](/packages/drupal-core-dev)[spekulatius/phpscraper

PHPScraper, built with simplicity in mind. See tests/ for more examples.

583143.5k3](/packages/spekulatius-phpscraper)[sproutcms/cms

Enterprise content management and framework

241.6k4](/packages/sproutcms-cms)[chameleon-system/chameleon-base

The Chameleon System core.

1026.5k3](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

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