Implements Google Search into the Spryker Suite

3.1.0 2023-03-17 08:48 UTC

This package is auto-updated.

Last update: 2023-09-17 10:24:52 UTC



Implements Google Search into the Spryker Suite


composer require fond-of-spryker/google-custom-search


First, you should complete the configuration of the Google API in your configuration, e.g. under config/shared/config_default.php

$config[GoogleCustomSearchConstants::API_KEY] = 'YOUR_API_KEY';
$config[GoogleCustomSearchConstants::CX_KEY] = 'SEARCH_ENGINE_KEY';
$config[GoogleCustomSearchConstants::CONFIG_TIMEOUT] = 5.0;
$config[GoogleCustomSearchConstants::RESULT_ITEMS_PER_PAGE] = 10;

For more information, see the official documentation at

You can add different CX_KEYs for locales by extending the key with the locale, in example:

$config[GoogleCustomSearchConstants::CX_KEY . '_fr_FR']

Dont forget the underscore between the key and locale!

The default route for search is localed with /de, you change this in the GoogleCustomSearchControllerProvider. If you dont need any localized route just remove the language parameter in URL.

    '/de/' . GoogleCustomSearchConstants::ROUTE_SEARCH_URL_VARIABLE

Add GoogleCustomSearchWidget::class to ShopApplicationDependencyProvider

protected function getGlobalWidgets(): array
        return [

Add GoogleCustomSearchControllerProviderPlugin to RouterDependencyProvider

protected function getRouteProvider(): array
        return [
            new GoogleCustomSearchControllerProviderPlugin(),

Render the form

To render the search form use the following code. If you want to change the routes, expand the module as you like using the Spryker workflow

{% widget 'GoogleCustomSearchWidget' only %}{% endwidget %}


The search results are displayed under the URL

/search (route name google-search-results).

If you need a different route, just expand the module how you like

Under /Yves/Theme/default/ search you will find two example templates. Feed free to implement your own.


2.0.0 - added Support for Spryker 202001.0

use {% widget 'GoogleCustomSearchWidget' only %}{% endwidget %} instead of {{ render(path('gcs/form')) }}
use new router FondOfSpryker\Yves\GoogleCustomSearch\Plugin\Router\GoogleCustomSearchControllerProviderPlugin instead of FondOfSpryker\Yves\GoogleCustomSearch\Plugin\Provider\GoogleCustomSearchControllerProvider }}