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.
Download serpapi/serpapi-php
More information about serpapi/serpapi-php
Files in serpapi/serpapi-php
Package serpapi-php
Short Description Get Google, Bing, Baidu, eBay, Yahoo, Yandex, Home Depot, Naver, Apple, DuckDuckGo, Yelp and YouTube search results via SerpApi.com
License MIT
Homepage https://github.com/serpapi/serpapi-php
Informations about the package serpapi-php
SerpApi PHP Library
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:
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 8.5
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
- source: tests/ExampleSearchGoogleAutocompleteTest.php see: https://serpapi.com/google-autocomplete-api
Search Google Shopping
Search Google Maps
Search Google Jobs
Search Google Events
Search Google Lens
Search Google Play
Search Google Local Services
- source: tests/ExampleSearchGoogleLocalServicesTest.php see: https://serpapi.com/google-local-services-api
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
- 1.0 - First stable version
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
ext-curl Version *
ext-json Version *