PHPackages                             watercrawl/php - 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. [API Development](/categories/api)
4. /
5. watercrawl/php

ActiveLibrary[API Development](/categories/api)

watercrawl/php
==============

PHP SDK for WaterCrawl REST APIs

v1.1.0(1y ago)04MITPHPPHP ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Feb 27Pushed 1y ago1 watchersCompare

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

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

WaterCrawl PHP Client
=====================

[](#watercrawl-php-client)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0e83ac9ebba3074a4d4effc68fb8f5c8e389a77ffd3989cc14bf88b62a06b66b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7761746572637261776c2f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/watercrawl/php)[![Build Status](https://camo.githubusercontent.com/ebdada94da94b0b8c35f445bac315cd86e31fba7bc83af4f23983caa254b2ff1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7761746572637261776c2f7761746572637261776c2d7068702f72656c656173652e796d6c3f6272616e63683d6d61696e267374796c653d666c61742d737175617265)](https://github.com/watercrawl/watercrawl-php/actions?query=workflow%3ARelease)[![PHP Version Support](https://camo.githubusercontent.com/48184dd030712938f82d17ed45c03da04034fb4e2d9acbf122205d3834a89357/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7761746572637261776c2f7068703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/watercrawl/php)[![Total Downloads](https://camo.githubusercontent.com/13f19d585fdbc13b124de618d1ceefa9f14110d642f45809a00f68abe8b84182/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7761746572637261776c2f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/watercrawl/php)[![License](https://camo.githubusercontent.com/242d3507ec83159baf333e882ac2c87d0cefd8439474c771f7be794898d7d46f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7761746572637261776c2f7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/watercrawl/php)

PHP Client for WaterCrawl REST APIs. This package provides a simple and elegant way to interact with WaterCrawl's web scraping and crawling services.

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

[](#installation)

You can install the package via composer:

```
composer require watercrawl/php
```

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- `ext-mbstring`
- `ext-json`

Usage
-----

[](#usage)

```
use WaterCrawl\APIClient;

// Initialize the client
$client = new APIClient('your-api-key');

// Scrape a single URL
$result = $client->scrapeUrl('https://example.com');

// Create a crawl request
$result = $client->createCrawlRequest(
    'https://example.com',
    ['allowed_domains' => ['example.com']],
    ['wait_time' => 1000]
);

// Monitor crawl progress
foreach ($client->monitorCrawlRequest($result['uuid']) as $update) {
    if ($update['type'] === 'result') {
        // Process the result
        print_r($update['data']);
    }
}
```

API Examples
------------

[](#api-examples)

### Crawling Operations

[](#crawling-operations)

#### List all crawl requests

[](#list-all-crawl-requests)

```
// Get the first page of requests (default page size: 10)
$requests = $client->getCrawlRequestsList();

// Specify page number and size
$requests = $client->getCrawlRequestsList(2, 20);
```

#### Get a specific crawl request

[](#get-a-specific-crawl-request)

```
$request = $client->getCrawlRequest('request-uuid');
```

#### Create a crawl request

[](#create-a-crawl-request)

```
// Simple request with just a URL
$request = $client->createCrawlRequest('https://example.com');

// Advanced request with options
$request = $client->createCrawlRequest(
    'https://example.com',
    [
        'max_depth' => 1, // maximum depth to crawl
        'page_limit' => 1, // maximum number of pages to crawl
        'allowed_domains' => [], // allowed domains to crawl
        'exclude_paths' => [], // exclude paths
        'include_paths' => [] // include paths
    ],
    [
        'exclude_tags' => [], // exclude tags from the page
        'include_tags' => [], // include tags from the page
        'wait_time' => 1000, // wait time in milliseconds after page load
        'include_html' => false, // the result will include HTML
        'only_main_content' => true, // only main content of the page
        'include_links' => false, // if true the result will include links
        'timeout' => 15000, // timeout in milliseconds
        'accept_cookies_selector' => null, // accept cookies selector
        'locale' => "en-US", // locale
        'extra_headers' => [], // extra headers
        'actions' => [] // actions to perform
    ],
    [] // plugin options
);
```

#### Stop a crawl request

[](#stop-a-crawl-request)

```
$client->stopCrawlRequest('request-uuid');
```

#### Download a crawl request result

[](#download-a-crawl-request-result)

```
// Download the crawl request results
$results = $client->downloadCrawlRequest('request-uuid');
```

#### Monitor a crawl request

[](#monitor-a-crawl-request)

```
// Monitor with automatic result download (default)
foreach ($client->monitorCrawlRequest('request-uuid') as $event) {
    if ($event['type'] === 'state') {
        echo "Crawl state: {$event['data']['status']}\n";
    } elseif ($event['type'] === 'result') {
        echo "Received result for: {$event['data']['url']}\n";
    }
}

// Monitor without downloading results
foreach ($client->monitorCrawlRequest('request-uuid', false) as $event) {
    echo "Event type: {$event['type']}\n";
}
```

#### Get crawl request results

[](#get-crawl-request-results)

```
// Get the first page of results
$results = $client->getCrawlRequestResults('request-uuid');

// Specify page number and size
$results = $client->getCrawlRequestResults('request-uuid', 2, 20);
```

#### Quick URL scraping

[](#quick-url-scraping)

```
// Synchronous scraping (default)
$result = $client->scrapeUrl('https://example.com');

// With page options
$result = $client->scrapeUrl(
    'https://example.com',
    [
        'wait_time' => 1000,
        'only_main_content' => true
    ]
);

// Asynchronous scraping
$request = $client->scrapeUrl('https://example.com', [], [], false);
// Later check for results with getCrawlRequest
```

### Sitemap Operations

[](#sitemap-operations)

#### Download a sitemap

[](#download-a-sitemap)

```
// Download using a crawl request object
$crawlRequest = $client->getCrawlRequest('request-uuid');
$sitemap = $client->downloadSitemap($crawlRequest);

// Or download using just the UUID
$sitemap = $client->downloadSitemap('request-uuid');

// Process sitemap entries
foreach ($sitemap as $entry) {
    echo "URL: {$entry['url']}, Title: {$entry['title']}\n";
}
```

#### Download sitemap as graph data

[](#download-sitemap-as-graph-data)

```
// You need to provide crawl request uuid or crawl request object
$graphData = $client->downloadSitemapGraph('request-uuid');
```

#### Download sitemap as markdown

[](#download-sitemap-as-markdown)

```
// You need to provide crawl request uuid or crawl request object
$markdown = $client->downloadSitemapMarkdown('request-uuid');

// Save to a file
file_put_contents('sitemap.md', $markdown);
```

### Search Operations

[](#search-operations)

#### Get search requests list

[](#get-search-requests-list)

```
// Get the first page of search requests
$searchRequests = $client->getSearchRequestsList();

// Specify page number and size
$searchRequests = $client->getSearchRequestsList(2, 20);
```

#### Create a search request

[](#create-a-search-request)

```
// Simple search with synchronous results
$results = $client->createSearchRequest('php programming');

// Search with options and limited results
$results = $client->createSearchRequest(
    'php tutorial',
    [
        'language' => null, // language code e.g. "en" or "fr"
        'country' => null, // country code e.g. "us" or "fr"
        'time_range' => 'any', // time range e.g. "any", "hour", "day", "week", "month", "year"
        'search_type' => 'web', // search type e.g. "web"
        'depth' => 'basic' // depth e.g. "basic", "advanced", "ultimate"
    ],
    5, // limit the number of results
    true, // wait for results
    true // download results
);

// Asynchronous search
$searchRequest = $client->createSearchRequest(
    'machine learning',
    [], // search options
    5, // limit the number of results
    false, // Don't wait for results
    false // Don't download results
);
```

#### Monitor a search request

[](#monitor-a-search-request)

```
// Monitor a search request
foreach ($client->monitorSearchRequest('search-uuid') as $event) {
    if ($event['type'] === 'state') {
        echo "Search state: {$event['status']}\n";
    }
}

// Monitor without downloading results
foreach ($client->monitorSearchRequest('search-uuid', false) as $event) {
    echo "Event: " . json_encode($event) . "\n";
}
```

#### Get a search request

[](#get-a-search-request)

```
$searchRequest = $client->getSearchRequest('search-uuid');
```

#### Stop a search request

[](#stop-a-search-request)

```
$client->stopSearchRequest('search-uuid');
```

Features
--------

[](#features)

- Simple and intuitive API
- Real-time crawl monitoring
- Configurable scraping options
- Automatic response handling
- Support for sitemaps and search operations
- PHP 7.4+ compatibility
- Proper UTF-8 support

Testing
-------

[](#testing)

```
composer test
```

Compatibility
-------------

[](#compatibility)

- WaterCrawl API &gt;= 0.7.1

Changelog
---------

[](#changelog)

Please see [CHANGELOG.md](https://github.com/watercrawl/watercrawl-php/blob/main/CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING.md](https://github.com/watercrawl/watercrawl-php/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/watercrawl/watercrawl-php/blob/main/LICENSE) for more information.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance48

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.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 ~31 days

Total

3

Last Release

383d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.1.0PHP ^7.4 || ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/08fab4dc71dd05cd417e1b925eefe35c31462fddfad7e4f7008f48ba9dc87608?d=identicon)[watercrawl](/maintainers/watercrawl)

---

Top Contributors

[![amirasaran](https://avatars.githubusercontent.com/u/6253691?v=4)](https://github.com/amirasaran "amirasaran (13 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (3 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/watercrawl-php/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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