PHPackages                             serpcheap/serpcheap - 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. serpcheap/serpcheap

ActiveLibrary[API Development](/categories/api)

serpcheap/serpcheap
===================

Official PHP client for the serp.cheap Google SERP API.

v0.2.0(1mo ago)0151MITPHPPHP &gt;=7.4

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/SerpCheap/serpcheap-php)[ Packagist](https://packagist.org/packages/serpcheap/serpcheap)[ Docs](https://serp.cheap)[ RSS](/packages/serpcheap-serpcheap/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

serpcheap
=========

[](#serpcheap)

[![Packagist Version](https://camo.githubusercontent.com/3b608e57bba331051742ca934d0522d526b90dba6644ccce157806ccc13a7d00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365727063686561702f736572706368656170)](https://packagist.org/packages/serpcheap/serpcheap)[![PHP version](https://camo.githubusercontent.com/d1ccdcd09af1d803d7a43236d4cdaa067f4f9091197dbb13062b99563884f51c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7365727063686561702f736572706368656170)](https://packagist.org/packages/serpcheap/serpcheap)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

Official PHP client for the [serp.cheap](https://serp.cheap) **Google Search API** — real-time Google SERP data (organic results, ads, knowledge graph, page scraping, rank tracking).

The **cheapest Google Search API** we know of: $0.0003 per cached search, $0.0006 fresh, no monthly minimum (~10× cheaper than SerpApi).

A thin, dependency-free client built on `ext-curl`. Works on PHP 7.4 → 8.4.

Install
-------

[](#install)

```
composer require serpcheap/serpcheap
```

Quickstart
----------

[](#quickstart)

```
use SerpCheap\Client;

$client = new Client('KEY');
$res = $client->search('best running shoes', ['gl' => 'us']);

echo $res->organic[0]->title;
```

Get an API key at [app.serp.cheap](https://app.serp.cheap).

Search parameters
-----------------

[](#search-parameters)

```
$client->search('best running shoes', [
    'gl'   => 'us',      // country, default "us"
    'hl'   => 'en',      // UI language (optional)
    'tbs'  => 'qdr:d',   // time filter: qdr:h / qdr:d / qdr:w (optional)
    'page' => 1,         // 1-indexed page, default 1
]);
```

The response is a `SerpCheap\SearchResponse`. JSON camelCase fields are exposed as public properties:

```
$res->search           // the query (string)
$res->page             // page number (int)
$res->organic          // OrganicResult[] (always an array)
$res->ads              // Ad[] | null
$res->knowledgeGraph   // KnowledgeGraph | null
$res->peopleAlsoAsk    // string[] | null
$res->relatedSearches  // RelatedSearch[] | null
$res->stats            // SearchStats(balance, cost, cached) | null
```

### Multiple pages

[](#multiple-pages)

```
// Eagerly fetch pages 1..5; stops on the first empty page.
$pages = $client->searchPages('best running shoes', 1, 5, ['gl' => 'us']);
```

### Scrape page content with the search

[](#scrape-page-content-with-the-search)

Attach page scraping to a search — each organic result gains `content`(markdown) and, when requested, a `screenshotUrl` (48h presigned URL):

```
$res = $client->search('best running shoes', [
    'scrape' => [
        'render_js'  => true,   // headless render for JS-heavy pages
        'screenshot' => true,   // capture a full-page screenshot
        'top_n'      => 3,      // how many top results to scrape (default 5)
    ],
]);

echo $res->organic[0]->content;        // markdown | null
echo $res->organic[0]->screenshotUrl;  // string | null
echo $res->organic[0]->scrapeError;    // why a page couldn't be scraped | null
```

Scrape a single page
--------------------

[](#scrape-a-single-page)

```
$page = $client->scrape('https://example.com', [
    'render_js'         => true,
    'screenshot'        => true,
    'wait_for'          => '#main', // CSS selector to await (render_js only)
    'wait_ms'           => 500,     // extra settle time (render_js only)
    'screenshot_width'  => 1920,    // default 1920, max 1920
    'screenshot_height' => 1080,    // default 1080, max 1920
]);

$page->title;          // string | null
$page->content;        // markdown | null
$page->contentText;    // plain text | null
$page->screenshotUrl;  // string | null
$page->stats;          // ScrapeStats(balance, cost) | null
```

Rank tracking
-------------

[](#rank-tracking)

Find where a domain or URL ranks for a keyword:

```
$res = $client->rank('example.com', 'best running shoes', [
    'gl'         => 'us',
    'pages'      => 3,        // result pages to scan, 1..10 (default 1)
    'match_type' => 'domain', // "domain" (registrable domain) or "exact" (identical URL)
]);

$res->found;          // bool
$res->rank;           // absolute rank of the best match, or null
$res->matches;        // RankMatch[] (rank, page, positionOnPage, link, title)
$res->organic;        // OrganicResult[] across scanned pages
$res->stats;          // RankStats(balance, cost, pagesCached, pagesFresh) | null
```

Client options
--------------

[](#client-options)

```
new Client('KEY', [
    'baseUrl'    => 'https://api.serp.cheap', // default
    'timeoutMs'  => 15000,                    // default
    'maxRetries' => 2,                        // default
]);
```

Transient failures (`429`, `503`, timeouts, network errors) are retried with backoff, honoring the API's `retry_after_ms`. `4xx` errors are never retried.

Errors
------

[](#errors)

Every failure throws `SerpCheap\SerpCheapException`:

```
use SerpCheap\SerpCheapException;

try {
    $client->search('coffee');
} catch (SerpCheapException $e) {
    $e->errorCode;     // e.g. "insufficient_credits", "rate_limited"
    $e->status;        // HTTP status (int|null)
    $e->retryAfterMs;  // set for rate_limited (int|null)
    $e->isRetryable(); // bool
}
```

Error codes mirror the API taxonomy: `invalid_request`, `missing_api_key`, `unknown_api_key`, `inactive_api_key`, `account_blocked`, `insufficient_credits`, `rate_limited`, `request_in_progress`, `too_many_concurrent_requests`, `service_temporarily_unavailable`, `result_timeout`, plus the client-side `client_timeout`, `network_error`, and `invalid_response`.

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance90

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% 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

48d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2975858?v=4)[William Bittencourt Moraes](/maintainers/darkwolf66)[@darkwolf66](https://github.com/darkwolf66)

---

Top Contributors

[![darkwolf66](https://avatars.githubusercontent.com/u/2975858?v=4)](https://github.com/darkwolf66 "darkwolf66 (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

googlephpscrapingsearch-apiserpserpcheapapisearchgooglescrapingSERP

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[serpwow/google-search-results

Google Search Results PHP package via SerpWow.com

1931.8k1](/packages/serpwow-google-search-results)[statickidz/php-google-translate-free

Google Translate Free library for PHP

288283.8k9](/packages/statickidz-php-google-translate-free)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69131.6k](/packages/serpapi-google-search-results-php)[gigablah/fsphinxphp

Facet extension for Sphinx Search

5364.5k](/packages/gigablah-fsphinxphp)[ozankurt/google-analytics

Laravel Google Analytics

7617.3k](/packages/ozankurt-google-analytics)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1244.0k1](/packages/skeeks-yii2-google-api)

PHPackages © 2026

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