PHPackages                             dilneiss/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. dilneiss/dusk-crawler

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

dilneiss/dusk-crawler
=====================

Web Crawler using Laravel Dusk

08PHP

Since Mar 20Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)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 "dilneiss/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

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% 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/339a3fb5132ca6fdf590eb87aaf69c97a45b1980dc3bb7109b89b531c56b4d62?d=identicon)[dilneiss](/maintainers/dilneiss)

---

Top Contributors

[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (55 commits)")[![upsite4k](https://avatars.githubusercontent.com/u/28684500?v=4)](https://github.com/upsite4k "upsite4k (3 commits)")[![dilneiss](https://avatars.githubusercontent.com/u/4564667?v=4)](https://github.com/dilneiss "dilneiss (2 commits)")

### Embed Badge

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

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

###  Alternatives

[vishnubob/wait-for-it

Pure bash script to test and wait on the availability of a TCP host and port

9.8k157.6k3](/packages/vishnubob-wait-for-it)[nodejs-php-fallback/nodejs-php-fallback

Allow you to call node.js module or scripts throught PHP and call a fallback function if node.js is not available

17454.7k8](/packages/nodejs-php-fallback-nodejs-php-fallback)

PHPackages © 2026

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