{"id":33948898,"url":"https://github.com/jdrda/laravel-google-custom-search-engine","last_synced_at":"2026-04-06T06:03:24.721Z","repository":{"id":41501005,"uuid":"75738026","full_name":"jdrda/laravel-google-custom-search-engine","owner":"jdrda","description":"Laravel package to get Google Custom Search results from Google Custom Search Engine API for both free and paid versions.","archived":false,"fork":false,"pushed_at":"2019-10-07T20:45:58.000Z","size":47,"stargazers_count":50,"open_issues_count":8,"forks_count":17,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-12-14T07:44:15.106Z","etag":null,"topics":["google-cse","laravel","php","search-engine"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdrda.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-06T14:17:13.000Z","updated_at":"2025-05-09T06:34:47.000Z","dependencies_parsed_at":"2022-08-25T07:00:31.951Z","dependency_job_id":null,"html_url":"https://github.com/jdrda/laravel-google-custom-search-engine","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jdrda/laravel-google-custom-search-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdrda%2Flaravel-google-custom-search-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdrda%2Flaravel-google-custom-search-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdrda%2Flaravel-google-custom-search-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdrda%2Flaravel-google-custom-search-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdrda","download_url":"https://codeload.github.com/jdrda/laravel-google-custom-search-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdrda%2Flaravel-google-custom-search-engine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31461534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["google-cse","laravel","php","search-engine"],"created_at":"2025-12-12T18:55:23.715Z","updated_at":"2026-04-06T06:03:24.716Z","avatar_url":"https://github.com/jdrda.png","language":"PHP","funding_links":["https://ko-fi.com/A067ES5"],"categories":[],"sub_categories":[],"readme":"[![SensioLabsInsight](https://insight.sensiolabs.com/projects/971d87c0-18b1-4c32-9cf1-4763345b8e70/mini.png)](https://insight.sensiolabs.com/projects/971d87c0-18b1-4c32-9cf1-4763345b8e70)\n[![GitHub version](https://badge.fury.io/gh/jdrda%2Flaravel-google-custom-search-engine.svg)](https://badge.fury.io/gh/jdrda%2Flaravel-google-custom-search-engine)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/546/badge)](https://bestpractices.coreinfrastructure.org/projects/546)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/jdrda/laravel-google-custom-search-engine/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/jdrda/laravel-google-custom-search-engine/?branch=master)\n[![Build Status](https://scrutinizer-ci.com/g/jdrda/laravel-google-custom-search-engine/badges/build.png?b=master)](https://scrutinizer-ci.com/g/jdrda/laravel-google-custom-search-engine/build-status/master)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4438fdee3b8b45b2b47ca38b29774fdc)](https://www.codacy.com/app/yan_2/laravel-google-custom-search-engine?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=jdrda/laravel-google-custom-search-engine\u0026amp;utm_campaign=Badge_Grade)\n[![Code Climate](https://codeclimate.com/github/jdrda/laravel-google-custom-search-engine/badges/gpa.svg)](https://codeclimate.com/github/jdrda/laravel-google-custom-search-engine)\n[![Dependency Status](https://gemnasium.com/badges/github.com/jdrda/laravel-google-custom-search-engine.svg)](https://gemnasium.com/github.com/jdrda/laravel-google-custom-search-engine)\n![](https://reposs.herokuapp.com/?path=jdrda/laravel-google-custom-search-engine)\n[![GitHub issues](https://img.shields.io/github/issues/jdrda/laravel-google-custom-search-engine.svg)](https://github.com/jdrda/laravel-google-custom-search-engine/issues)\n[![GitHub forks](https://img.shields.io/github/forks/jdrda/laravel-google-custom-search-engine.svg)](https://github.com/jdrda/laravel-google-custom-search-engine/network)\n[![GitHub stars](https://img.shields.io/github/stars/jdrda/laravel-google-custom-search-engine.svg)](https://github.com/jdrda/laravel-google-custom-search-engine/stargazers)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/jdrda/laravel-google-custom-search-engine/master/license.md)\n[![Packagist](https://img.shields.io/packagist/v/jan-drda/laravel-google-custom-search-engine.svg)]()\n[![Packagist](https://img.shields.io/packagist/dt/jan-drda/laravel-google-custom-search-engine.svg)]()\n#Laravel Google Custom Search Engine\nLaravel package to get Google Custom Search results from Google Custom Search Engine API for both free and paid version.\n\n#### Brief history\nAs Swiftype closed free plans, I started to find some alternative without too much coding, but was unsucessfull.\nThe best I found was [Spatie's Google Search package](https://github.com/spatie/googlesearch) for Google CSE paid version, so I made\nsome research and develop package similar way, but independent to Google CSE version.\n \n#### Coffee for developers\nIf you like this project, you can buy me a coffee to help me get fresh. :)\nhttps://ko-fi.com/A067ES5\n\n## Installation\n1/ Install with Composer\n\n```bash\ncomposer require jan-drda/laravel-google-custom-search-engine\n```\n\n2/ Add the service provider to config/app.php\n\n```php\n'providers' =\u003e [\n    '...',\n    'JanDrda\\LaravelGoogleCustomSearchEngine\\LaravelGoogleCustomSearchEngineProvider'\n];\n```\n3/ Add alias for Facade to config/app.php\n```php\n'aliases' =\u003e [\n\t...\n\t'GoogleCseSearch' =\u003e 'JanDrda\\LaravelGoogleCustomSearchEngine\\Facades\\LaravelGoogleCustomSearchEngineProvider',\n\t...\n]\n```\n\n4/ Publish the config file\n```bash\nphp artisan vendor:publish --provider=\"JanDrda\\LaravelGoogleCustomSearchEngine\\LaravelGoogleCustomSearchEngineProvider\"\n```\n\n## Configuration\n\n### Creating your custom search engine\n1. If you create your engine at https://cse.google.com/cse/ you will find the ID after you click at Settings\n2. Just check the URL you have like https://cse.google.com/cse/setup/basic?cx=search_engine_id and the string after cx= is your search engine ID\n     \n!! Attention !! If you change style of your Custom search engine, the ID can be changed\n\n### Get your API key\n1. go to https://console.developers.google.com, than\n2. click on the menu on the right side of the GoogleAPI logo and click on 'Create project'\n3. enter the name of the new project - it is up to you, you can use 'Google CSE'\n4. wait until project is created - the indicator is color circle on the top right corner around the bell icon\n5. API list is shown - search for 'Google Custom Search API' and click on it\n6. click on 'Enable' icone on the right side of Custom Search API headline\n7. click on the 'Credentials' on the left menu under the 'Library' section\n8. click on the 'Create credentials' and choose 'API key'\n9. your API key is shown, so copy and paste it here\n\n### Save the configuration values\nSave search engine ID and api ID in your config/laravelGoogleCustomSearchEngine.php\n\n## Usage\n\n### Simple usage\nCreate an object and call the function getResults to get first 10 results\n```php\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n$results = $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase' \n```\n\n#### Do not forget to map namespace with, so sample controller will look like this (in min. way)\nIt is only example controller name, you can use whatever you want, this is notice mainly for novices in Laravel\n```php\nnamespace App\\Http\\Controllers;\n\nuse App\\Http\\Controllers\\Controller;\nuse JanDrda\\LaravelGoogleCustomSearchEngine\\LaravelGoogleCustomSearchEngine;\n\nclass GoogleSearchController extends Controller\n{\n\n  public function index(){\n    $fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n    $results = $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase' \n  }\n}\n```\n\nYou can also get information about the search like total records and search time\n```php\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n$results = $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase' \n$info = $fulltext-\u003egetSearchInformation(); // get search information\n```\n\n### Advanced usage\nYou can use any parameter supported at Google. List of parameters is here:\nhttps://developers.google.com/custom-search/json-api/v1/reference/cse/list#parameters\n\nE.g. you want to get next 10 results\n```php\n$parameters = array(\n    'start' =\u003e 10 // start from the 10th results,\n    'num' =\u003e 10 // number of results to get, 10 is maximum and also default value\n)\n\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n$results = $fulltext-\u003egetResults('some phrase', $parameters); // get second 10 results for query 'some phrase'\n```\n\nYou can also get the raw result from Google including other information\nFull list of response variables is available here:\nhttps://developers.google.com/custom-search/json-api/v1/reference/cse/list#response\n```php\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n$results = $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase'\n$rawResults = $fulltext-\u003egetRawResults(); // get complete response from Google\n```\n\nFor getting the number of results only use\n```php\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n$results =  $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase'\n$noOfResults = $fulltext-\u003egetTotalNumberOfResults(); // get total number of results (it can be less than 10)\n```\n\nIf you have more engines / more api keys, you can override the config variables with following functions\n\n```php\n$fulltext = new LaravelGoogleCustomSearchEngine(); // initialize\n\n$fulltext-\u003esetEngineId('someEngineId'); // sets the engine ID\n$fulltext-\u003esetApiKey('someApiId'); // sets the API key\n\n$results =  $fulltext-\u003egetResults('some phrase'); // get first 10 results for query 'some phrase'\n```\n\n## Documentation\nEssetial documentation will be at [Github Wiki](https://github.com/jdrda/laravelgooglecsesearch/wiki)\nNow is under the development.\n\n## License\nThis package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) \n\n## About\nI am independent senior software consultant living in the Czech republic in IT business from 1997.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdrda%2Flaravel-google-custom-search-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdrda%2Flaravel-google-custom-search-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdrda%2Flaravel-google-custom-search-engine/lists"}