1. Go to this page and download the library: Download spatie/googlesearch library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
/*
This function returns an array with keys
"name" // the name of the found page
"url" // the url of the found page
"snippet" // a little piece of text found on the page
*/
$searchResults = GoogleSearch::getResults('The meaning of life'); // is 42