PHPackages                             ppajer/searchresults - 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. [Search &amp; Filtering](/categories/search)
4. /
5. ppajer/searchresults

ActiveLibrary[Search &amp; Filtering](/categories/search)

ppajer/searchresults
====================

A convenient way to get SERPs for further processing.

029PHP

Since Aug 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ppajer/SearchResults)[ Packagist](https://packagist.org/packages/ppajer/searchresults)[ RSS](/packages/ppajer-searchresults/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependenciesVersions (1)Used By (0)

SearchResults
=============

[](#searchresults)

A convenient way to get SERPs for further processing. Supports only Google currently, will become extendable in the future.

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

[](#requirements)

- PHP7+
- [WebScraper](https://github.com/ppajer/WebScraper) (part of the composer package)
- [DOM Extractor](https://github.com/ppajer/PHP-DOM-Extractor) (bundled with WebScraper)
- [Request](https://github.com/ppajer/PHP-Request) (bundled with WebScraper)

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

[](#installation)

Install via either Composer or by downloading the repository locally. Note: this package requires [WebScraper](https://github.com/ppajer/WebScraper) to work, so if installing manually, you will need to include the scraper and its dependencies ([DOM Extractor](https://github.com/ppajer/PHP-DOM-Extractor) and [Request](https://github.com/ppajer/PHP-Request)) manually.

Methods and properties
----------------------

[](#methods-and-properties)

```
class SearchResults {

	public $query : String 	// The search term for the results
	public $limit : Int 		// The number of pages to fetch. Default: 1
	public $location : String|null // A canonical location name.
	public $results : Array 	// The search results.

	public function __construct__(Array $args) : // Where $args is an Array with 'query', 'limit' and 'location' as possible keys.
	public function get() : Array // Returns the results
	public static function getMultiple(Array $args) : Array // Returns an array of SearchResult objects
	public static function autocompleteSearchLocation(String $query) : Array // Returns an array of search locations
}

```

Usage
-----

[](#usage)

Simply include the required files and provide search options to the constructor. These include: `query`, `limit` and `location`.

```
require 'Webscraper.php';
require 'SearchResults.php';

$search = [
	'query' => 'Budapest', // The query to search
	'limit' => 3 // Number of pages fetched
	'location' => 'New York, United States' // The location to show searches from
	];
$serps = new SearchResults($search);

foreach ($serps as $position => $result) {
	echo "Result URL #$position:".$result['link'];
}

```

### Multiple keywords

[](#multiple-keywords)

You can also query for an array of keywords by using the `getMultiple()` method. It accepts an array of arrays similar to the one expected by the constructor.

```
$multipleWithLimits = [
	[
		'query' => 'Budapest',
		'limit' => 5
	],
	[
		'query' => 'Sopron',
		'limit' => 2,
		'location' => 'London, United Kingdom'
	]
];

$results = SearchResults::getMultiple($multipleWithLimits);
// Returns an array of SearchResult objects
// Results will have 5 and 2 pages respectively, from different locations.

```

### Location support

[](#location-support)

The libraray includes a list of all canonical names supported by Google. You can use this list to find the canonical name of the location you're interested in. The list is quite large (74000 entries), so it is useful to offer autocomplete functionality to your users. You can do so by using your frontend solution of choice, coupled with the `autocompleteSearchLocation()` method on the backend.

To improve search speed and reduce memory usage, a simplified list is also provided - this trades precision for reduced size, with only 200 entries that should suit most low-precision location needs. Simply pass an optional parameter to the autocomplete method to fetch the simplified list.

```

// This will listen to requests containing the q parameter and automatically return it to the browser
SearchResults::autocompleteSearchLocation();

// This does the same thing, but searched from the simplified list for improved speed
SearchResults::autocompleteSearchLocation(true);

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e6212007de7bf9a8e3591e60269ffaf607a962926182e21646b8f9975a879e4?d=identicon)[ppajer](/maintainers/ppajer)

---

Top Contributors

[![ppajer](https://avatars.githubusercontent.com/u/5861559?v=4)](https://github.com/ppajer "ppajer (11 commits)")

### Embed Badge

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

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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