Download the PHP package serpapi/serpapi-php without Composer

On this page you can find all versions of the php package serpapi/serpapi-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package serpapi-php

SerpApi PHP Library

Packagist Version PHP License: MIT

Integrate search data into your PHP application. This library is the official wrapper for SerpApi.

SerpApi supports Google, Google Maps, Google Shopping, Baidu, Yandex, Yahoo, eBay, App Stores, and more.

This is the new library provided by SerpApi as a replacement for our old library that can be found here. Feel free to contact us if you need any help: [email protected]

The full documentation is available here.

The following services are provided:

SerpApi provides a script builder to get you started quickly.

Installation

PHP 7.2+ with ext-curl and ext-json must be installed along with the Composer dependency management tool.

Tested PHP versions:

Package available from packagist.

Quick start

Simple Usage

This example runs a search for "coffee" on Google. It returns the results as a PHP object decoded from JSON.

See the playground to generate your own code.

Response formats

Use search for structured results decoded into a PHP object:

Use md for a token-efficient Markdown string optimized for LLMs and AI agents:

Use html when you need the raw search-engine response:

Archived results are also available as Markdown with $client->searchArchive($searchId, 'md').

Learn more about SerpApi Markdown output.

Configuration

API key

The API key can be set in the constructor or later via setApiKey:

Get your API key from serpapi.com/dashboard.

Engine

The default engine is google. You can change it via the second constructor parameter:

Timeout

The default request timeout is 120 seconds. Customize it via the third constructor parameter:

Search API

Search Google

Search Google Scholar

Search Google Autocomplete

Search Google Shopping

Search Google Maps

Search Google Jobs

Search Google Events

Search Google Lens

Search Google Play

Search Google Local Services

Search Bing

Search Baidu

Search Yahoo

Search YouTube

Search Walmart

Search eBay

Search Naver

Search Home Depot

Search Apple App Store

Search DuckDuckGo

APIs supported

Location API

NOTE: api_key is not required for this endpoint.

Search Archive API

First, run a search and save the search ID:

Now retrieve the previous search from the archive (free of charge):

Account API

HTML results

Error handling

SerpApiException includes structured context for HTTP and API errors (status code, endpoint, search params, search id).

Testing

We love "true open source", "continuous integration", and Test Driven Development (TDD). We use PHPUnit to test our infrastructure around the clock using GitHub Actions to achieve the best QoS (Quality of Service).

The tests/ directory includes specifications that serve the dual purpose of examples and functional tests.

Set your secret API key in your shell before running tests:

Install dependencies and run the test suite:

Contributions are welcome. Feel free to submit a pull request!

Change log

Conclusion

SerpApi supports all the major search engines. Google has more advanced support, with all the major services available: Images, News, Shopping, and more...

The full documentation is available here.

Authors: Victor Benarbia [email protected], Alaa Abdulridha [email protected] For more information: https://serpapi.com

License

MIT


All versions of serpapi-php with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package serpapi/serpapi-php contains the following files

Loading the files please wait ...