PHPackages                             orvice/google-custom-search-api - 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. orvice/google-custom-search-api

ActiveLibrary[API Development](/categories/api)

orvice/google-custom-search-api
===============================

Google Custom Search api

0311PHP

Since Apr 15Pushed 10y ago1 watchersCompare

[ Source](https://github.com/orvice/google-apis-php-clients)[ Packagist](https://packagist.org/packages/orvice/google-custom-search-api)[ RSS](/packages/orvice-google-custom-search-api/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Google APIs PHP Clients
=======================

[](#google-apis-php-clients)

The aim of this project is to create a well structured PHP library for accessing Google APIs available through the [Google APIs console](https://code.google.com/apis/console/).

Currently the library enables you to interact programmatically with the following Google APIs,

- [Google Custom Search API v1](https://code.google.com/apis/customsearch/v1/overview.html)
- [Google Translate API v2](http://code.google.com/apis/language/translate/overview.html) *(Paid service only as of Dec 1st, 2011)*
- (More coming soon)

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

[](#requirements)

- The library is only supported on PHP 5.3.0 and up.
- It has been assumed an autoloader will be present. If you require one, you can find one [here](http://groups.google.com/group/php-standards/web/psr-0-final-proposal).
- Each API requires an API key, which you can get from the [Google APIs console](https://code.google.com/apis/console/).

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

[](#installation)

Simply download the library and add the `src` folder to your project.

Usage
-----

[](#usage)

**Note:** More extensive documentation will be made available at a later date.

### Custom Search API

[](#custom-search-api)

**Note:** As well as an API key, the [Google Custom Search API v1](https://code.google.com/apis/customsearch/v1/overview.html) also requires either a [Google Custom Search](http://www.google.com/cse/) ID or specification URL.

The following makes a simple [Google Custom Search API v1](https://code.google.com/apis/customsearch/v1/overview.html) request,

```
$apiClient = new \Google\Api\CustomSearch();
$apiClient->setApiKey('INSERT_YOUR_API_KEY_HERE');
$apiClient->setCustomSearchEngineId('INSERT_YOUR_CUSTOM_SEARCH_ENGINE_ID_HERE');
$apiClient->setQuery('flowers');

$response = $apiClient->executeRequest();

```

To get the results from the `$response`,

```
if ($response->isSuccess())
{
    foreach($response->getData()->getItems() as $item)
    {
        echo $item->getHtmlTitle(), ' - ', $item->getDisplayLink(), '';
    }
}

```

### Translate API

[](#translate-api)

The following makes a simple [Google Translate API v2](http://code.google.com/apis/language/translate/overview.html) request,

```
$apiClient = new \Google\Api\Translate();
$apiClient->setApiKey('INSERT_YOUR_API_KEY_HERE');
$apiClient->addSourceText('The quick brown fox jumps over the lazy dog.');
$apiClient->setTargetLanguage('fr');

$response = $apiClient->executeRequest();

```

To get the translations from the `$response`,

```
if ($response->isSuccess())
{
    foreach($response->getData()->getTranslations() as $translation)
    {
        echo $translation->getTranslatedText(), '';
    }
}

```

Testing
-------

[](#testing)

To run the tests, make sure you have PHPUnit 3.6.0 and up installed, and just run the following in the project root,

```
phpunit

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.5% 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/28576f8bc727ae2bb4adc086208b17a2a910c2917f874f9f0848d97b88ead248?d=identicon)[orvice](/maintainers/orvice)

---

Top Contributors

[![stephenmelrose](https://avatars.githubusercontent.com/u/210524?v=4)](https://github.com/stephenmelrose "stephenmelrose (43 commits)")[![orvice](https://avatars.githubusercontent.com/u/1532235?v=4)](https://github.com/orvice "orvice (2 commits)")[![davidebuldrini](https://avatars.githubusercontent.com/u/3622217?v=4)](https://github.com/davidebuldrini "davidebuldrini (1 commits)")

### Embed Badge

![Health badge](/badges/orvice-google-custom-search-api/health.svg)

```
[![Health](https://phpackages.com/badges/orvice-google-custom-search-api/health.svg)](https://phpackages.com/packages/orvice-google-custom-search-api)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[botman/driver-telegram

Telegram driver for BotMan

93452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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