PHP code example of euclid1990last / php-google-suggest

1. Go to this page and download the library: Download euclid1990last/php-google-suggest 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/ */

    

euclid1990last / php-google-suggest example snippets




use euclid1990\PhpGoogleSuggest\GoogleSuggest;

    'providers' => [
        // ...
        'euclid1990\PhpGoogleSuggest\Providers\GoogleSuggestServiceProvider',
    ]

    'providers' => [
        // ...
        euclid1990\PhpGoogleSuggest\Providers\GoogleSuggestServiceProvider::class,
    ]

    'aliases' => [
        // ...
        'GoogleSuggest' => 'euclid1990\PhpGoogleSuggest\Facades\GoogleSuggest',
    ]

    'aliases' => [
        // ...
        'GoogleSuggest' => euclid1990\PhpGoogleSuggest\Facades\GoogleSuggest::class,
    ]



use euclid1990\PhpGoogleSuggest\GoogleSuggest;

$configArr = ew GoogleSuggest(new Illuminate\Config\Repository($config));

$english = 'Google';
$result = $googleSuggest->search($english, $configArr['language']);
echo "Search results for English keyword.\n";
print_r($result);

$japanese = 'あいうえお';
$result = $googleSuggest->search($japanese, $configArr['language']);
echo "Search results for Japanese keyword.\n";
print_r($result);

$vietnamese = 'tìm';
$result = $googleSuggest->search($vietnamese, $configArr['language']);
echo "Search results for Vietnamese keyword.\n";
print_r($result);

$keyword = 'suggest';
// Class method
\GoogleSuggest::search($keyword);
// Helper
google_suggest($keyword);

composer 

# php demo/run.php