PHPackages                             yangweijie/dusk-crawler - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. yangweijie/dusk-crawler

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yangweijie/dusk-crawler
=======================

Web Crawler using Laravel Dusk

v2.2.4(1y ago)07MITPHPPHP &gt;=7.2

Since Dec 30Pushed 1y agoCompare

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

READMEChangelog (8)Dependencies (6)Versions (9)Used By (0)

Web Crawler using Laravel Dusk
==============================

[](#web-crawler-using-laravel-dusk)

[![tests](https://github.com/katsana/dusk-crawler/workflows/tests/badge.svg?branch=master)](https://github.com/katsana/dusk-crawler/actions?query=workflow%3Atests+branch%3Amaster)[![Latest Stable Version](https://camo.githubusercontent.com/c2b1f630e6a16fa84e7e74236f33e1caea692b0055edd85786ced3cbf059eefc/68747470733a2f2f706f7365722e707567782e6f72672f6b617473616e612f6475736b2d637261776c65722f762f737461626c65)](https://packagist.org/packages/katsana/dusk-crawler)[![Total Downloads](https://camo.githubusercontent.com/79cd47b1a24274a1cd39712522f3d662818c7b6950d535a61df0471b2d41b5b9/68747470733a2f2f706f7365722e707567782e6f72672f6b617473616e612f6475736b2d637261776c65722f646f776e6c6f616473)](https://packagist.org/packages/katsana/dusk-crawler)[![Latest Unstable Version](https://camo.githubusercontent.com/765a9012b93a8fdab882c6e5495550bbf550e9ea269a1eaba36255ffca643254/68747470733a2f2f706f7365722e707567782e6f72672f6b617473616e612f6475736b2d637261776c65722f762f756e737461626c65)](https://packagist.org/packages/katsana/dusk-crawler)[![License](https://camo.githubusercontent.com/194b08e898aacaafc87d9546f787354f869a1dc5b3d61c950743aef7900962f9/68747470733a2f2f706f7365722e707567782e6f72672f6b617473616e612f6475736b2d637261776c65722f6c6963656e7365)](https://packagist.org/packages/katsana/dusk-crawler)

**Laravel Dusk** enables developer to run browser automation but it does lack the ability to navigate actions based on response received on the browser. If you need to handle failure you have to wait until the timeout expired and handle the generic exception.

**Dusk Crawler** solve this by adding `inspectUsing()` method to allow developer to inspect for success or fail status using [Promise by ReactPHP](https://github.com/reactphp/promise).

Installation
------------

[](#installation)

Dusk Crawler can be installed via composer:

```
composer require "yangweijie/dusk-crawler"

```

### Usages

[](#usages)

**Dusk Crawler** just add two new macros to `Laravel\Dusk\Browser`:

MethodDescription`inspectUsing()`Similar to `waitUsing()` but allow you to either return `abort(string $exception)`/`reject(\Throwable $throwable)` (fail) or `resolve()` (success) state based on available elements or texts on the browser.`crawler`Return an instance of `Symfony\Component\DomCrawler\Crawler` to allow developer to crawl the result.#### Example

[](#example)

Let say you want to crawl Packagist to search for some package, and the input is dynamic.

```
use DuskCrawler\Dusk;
use DuskCrawler\Inspector;
use DuskCrawler\Exceptions\InspectionFailed;
use Laravel\Dusk\Browser;

function searchPackagist(string $packagist) {
    $dusk = new Dusk('search-packagist');

    $dusk->headless()->disableGpu()->noSandbox();
    $dusk->userAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36');

    $dusk->start();

    $dusk->browse(function ($browser) use ($packagist) {
        $browser->visit('https://packagist.org/');

        $promise = $browser->type('search_query[query]', $packagist, '{enter}')
            ->inspectUsing(15, function (Browser $browser, Inspector $inspector) {
                $searchList = $browser->resolver->findOrFail('.search-list');

                if (! $searchList->isDisplayed() || $searchList->getText() == '') {
                    // result not ready, just return false.
                    return false;
                }

                if ($searchList->getText() == 'No packages found.') {
                    return $inspector->abort('No packages found!');
                }

                return $inspector->resolve();
            });

        $promise->then(function ($browser) {
            // Crawl the page on success.
            $packages = $browser->crawler()
              ->filter('div.package-item')->each(function ($div) {
                return $div->text();
            });

            dump($packages);
        })->otherwise(function (InspectionFailed $exception) {
            // Handle abort state.
            dump("No result");
        })->done();
    });

    $dusk->stop();
}

searchPackagist('dusk-crawler');

Dusk::closeAll();
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance41

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.3% 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 ~0 days

Total

8

Last Release

496d ago

Major Versions

v0.2.3 → v2.2.42024-12-30

### Community

Maintainers

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

---

Top Contributors

[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (55 commits)")[![yangweijie](https://avatars.githubusercontent.com/u/1614114?v=4)](https://github.com/yangweijie "yangweijie (11 commits)")

### Embed Badge

![Health badge](/badges/yangweijie-dusk-crawler/health.svg)

```
[![Health](https://phpackages.com/badges/yangweijie-dusk-crawler/health.svg)](https://phpackages.com/packages/yangweijie-dusk-crawler)
```

###  Alternatives

[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.4k187.2M2.6k](/packages/composer-composer)[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.6M63](/packages/react-react)[reactivex/rxphp

Reactive extensions for php.

1.7k3.2M49](/packages/reactivex-rxphp)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[ashallendesign/favicon-fetcher

A Laravel package for fetching website's favicons.

190272.4k3](/packages/ashallendesign-favicon-fetcher)

PHPackages © 2026

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