PHP code example of imarc / craft-googlecustomsearch

1. Go to this page and download the library: Download imarc/craft-googlecustomsearch 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/ */

    

imarc / craft-googlecustomsearch example snippets



return [
    'apiKey' => getenv('GOOGLE_SEARCH_API_KEY'),
    'searchEngineId' => getenv('GOOGLE_SEARCH_ENGINE_ID'),
];


return [
    'siteSettings' => [
        'default' => [
            'apiKey' => getenv('GOOGLE_SEARCH_API_KEY'),
            'searchEngineId' => getenv('GOOGLE_SEARCH_ENGINE_ID'),
        ],
        'fr' => [
            'apiKey' => getenv('GOOGLE_SEARCH_API_KEY_FR'),
            'searchEngineId' => getenv('GOOGLE_SEARCH_ENGINE_ID_FR'),
        ],
    ],
];


return [
    'apiKey' => [
        'default' => getenv('GOOGLE_SEARCH_API_KEY'),
        'fr' => getenv('GOOGLE_SEARCH_API_KEY_FR'),
    ],
    'searchEngineId' => [
        'default' => getenv('GOOGLE_SEARCH_ENGINE_ID'),
        'fr' => getenv('GOOGLE_SEARCH_ENGINE_ID_FR'),
    ],
];