PHPackages                             amark/laravelsearchengine - 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. amark/laravelsearchengine

ActiveLibrary[API Development](/categories/api)

amark/laravelsearchengine
=========================

Laravel package to get Google Custom Search results from Google Custom Search Engine API.

03PHP

Since Jul 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/amarjeetkaur111/laravel-search-engine)[ Packagist](https://packagist.org/packages/amark/laravelsearchengine)[ RSS](/packages/amark-laravelsearchengine/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#installation)

1/ Install with Composer

```
composer require amark/laravelsearchengine
```

2/ Add the service provider to config/app.php

```
'providers' => [
    '...',
    AmarK\LaravelSearchEngine\LaravelSearchEngineProvider::class
];
```

### Creating your custom search engine

[](#creating-your-custom-search-engine)

1. If you create your engine at  you will find the ID after you click at Settings
2. Just check the URL you have like [https://cse.google.com/cse/setup/basic?cx=search\_engine\_id](https://cse.google.com/cse/setup/basic?cx=search_engine_id) and the string after cx= is your search engine ID

!! Attention !! If you change style of your Custom search engine, the ID can be changed

### Get your API key

[](#get-your-api-key)

1. go to , than
2. click on the menu on the right side of the GoogleAPI logo and click on 'Create project'
3. enter the name of the new project - it is up to you, you can use 'Google CSE'
4. wait until project is created - the indicator is color circle on the top right corner around the bell icon
5. API list is shown - search for 'Google Custom Search API' and click on it
6. click on 'Enable' icone on the right side of Custom Search API headline
7. click on the 'Credentials' on the left menu under the 'Library' section
8. click on the 'Create credentials' and choose 'API key'
9. your API key is shown, so copy and paste it here

### Save the configuration values

[](#save-the-configuration-values)

Save search engine ID and api ID in your config/laravelSearchEngine.php

Usage
-----

[](#usage)

Create an object and call the function getResults to get first 10 results

```
$textresult = new LaravelSearchEngine(); // initialize
$results = $textresult->getResults('search text'); // get first 10 results for query 'search text'
```

```
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use AmarK\LaravelSearchEngine\LaravelSearchEngine;

class GoogleSearchController extends Controller
{

  public function index(){
    $textResult = new LaravelSearchEngine(); // initialize
    $results = $textResult->getResults('search text'); // get first 10 results for query 'search text'
  }
}
```

```
$parameters = array(
    'start' => 10 // start from the 10th results,
    'num' => 10 // number of results to get, 10 is maximum and also default value
)

$textresult = new LaravelSearchEngine(); // initialize
$results = $textresult->getResults('search text', $parameters); // get second 10 results for query 'search text'
```

```
$textResult = new LaravelSearchEngine(); // initialize
$results = $textResult->getResults('search text'); // get first 10 results for query 'search text'
$rawResults = $textResult->getRawResults(); // get complete response from Google
```

For getting the number of results only use

```
$textResult = new LaravelSearchEngine(); // initialize
$results =  $textResult->getResults('search text'); // get first 10 results for query 'search text'
$noOfResults = $textResult->getTotalNumberOfResults(); // get total number of results (it can be less than 10)
```

If you have more engines / more api keys, you can override the config variables with following functions

```
$textResult = new LaravelSearchEngine(); // initialize

$textResult->setEngineId('someEngineId'); // sets the engine ID
$textResult->setApiKey('someApiId'); // sets the API key

$results =  $textResult->getResults('search text'); // get first 10 results for query 'search text'
```

If looking for only Search URl, Title &amp; Description. By Default only 10 results are given

```
$textResult = new LaravelSearchEngine(); // initialize
$results =  $textResult->getResults('search text'); // get first 10 results for query 'search text'
$fewResults =  $textResult->getFewDetails(); // get first 10 results for query 'search text'
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

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/7ae832f64ac32a59294a583d4c8caf6b4a22c27564afd58bc56639bb8fd3cff9?d=identicon)[amarjeetkaur111](/maintainers/amarjeetkaur111)

### Embed Badge

![Health badge](/badges/amark-laravelsearchengine/health.svg)

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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