PHPackages                             moddix/serpapi - 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. moddix/serpapi

ActiveLibrary[API Development](/categories/api)

moddix/serpapi
==============

SerpApi PHP client library

1.0.0(6mo ago)026MITPHPPHP &gt;=8.2

Since Jan 12Pushed 6mo agoCompare

[ Source](https://github.com/Moddix-Deeplay/serpapi)[ Packagist](https://packagist.org/packages/moddix/serpapi)[ RSS](/packages/moddix-serpapi/feed)WikiDiscussions master Synced 4w ago

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

SerpApi PHP Client
==================

[](#serpapi-php-client)

A flexible PHP client for interacting with the [SerpApi](https://serpapi.com/) search API. Supports Google and Bing search engines, with extensible options and robust error handling.

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

[](#requirements)

- PHP 8.2 or higher
- PSR-18 compatible HTTP client (e.g., Symfony HttpClient)
- PSR-17 compatible request factory (e.g., Nyholm/psr7)

Features
--------

[](#features)

- Easy integration with SerpApi for Google and Bing search
- Strongly-typed search options (DTOs) for each engine
- Extensible architecture for adding new search engines
- Comprehensive exception handling (API, network, validation, server errors)
- PSR-18 HTTP client and PSR-17 request factory support

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

[](#installation)

Install via Composer:

```
composer require moddix/serpapi
```

Usage Example
-------------

[](#usage-example)

```
use Moddix\SerpApi\GoogleSearchClient;
use Moddix\SerpApi\Dto\GoogleSearchOptions;
use Moddix\SerpApi\Dto\SerpApiOptions;
use Nyholm\Psr7\Factory\Psr17Factory;
use Symfony\Component\HttpClient\Psr18Client;

$apiKey = 'your_serpapi_key';
$httpClient = new Psr18Client();
$requestFactory = new Psr17Factory();
$googleOptions = new GoogleSearchOptions(gl: 'us', hl: 'en');
$serpApiOptions = new SerpApiOptions(no_cache: true);

$client = new GoogleSearchClient(
    $apiKey,
    $httpClient,
    $requestFactory,
    $googleOptions,
    $serpApiOptions
);

try {
    $results = $client->search('pizza');
    print_r($results);
} catch (\Moddix\SerpApi\Exception\ApiException $e) {
    // Handle API error
} catch (\Moddix\SerpApi\Exception\NetworkException $e) {
    // Handle network error
}
```

Project Structure
-----------------

[](#project-structure)

- `src/` — Main source code
    - `Dto/` — Data Transfer Objects for search options
    - `Enum/` — Enumerations for search parameters
    - `Exception/` — Custom exception classes
- `tests/` — PHPUnit tests

Running Tests
-------------

[](#running-tests)

Run all tests using PHPUnit:

```
./vendor/bin/phpunit tests
```

License
-------

[](#license)

MIT License.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance66

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

207d ago

### Community

Maintainers

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

---

Top Contributors

[![Moddix-Deeplay](https://avatars.githubusercontent.com/u/138650566?v=4)](https://github.com/Moddix-Deeplay "Moddix-Deeplay (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k19](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)[cakephp/cakephp

The CakePHP framework

8.9k20.0M1.8k](/packages/cakephp-cakephp)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M58](/packages/getbrevo-brevo-php)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.6M96](/packages/mollie-mollie-api-php)

PHPackages © 2026

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