Download the PHP package setono/sylius-geo-plugin without Composer
On this page you can find all versions of the php package setono/sylius-geo-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download setono/sylius-geo-plugin
More information about setono/sylius-geo-plugin
Files in setono/sylius-geo-plugin
Package sylius-geo-plugin
Short Description Setono example plugin for Sylius.
License MIT
Informations about the package sylius-geo-plugin
Sylius Geo Plugin
This plugin adds geo related functionality to your store. Right now it comes with these two features:
- Redirect visitors based on their country
- Output
hreflang
link tags with a Twig function to help search engines discover regional versions of your store
Installation
Step 1: Download the plugin
Step 2: Enable the plugin
Then, enable the plugin by adding it to the list of registered plugins/bundles
in config/bundles.php
file of your project before (!) SyliusGridBundle
:
Step 3: Configure plugin
Step 4: Import routing
Step 5: Update your database schema
Step 6: Use an existing country code provider or create a new one
The plugin uses country code providers to provide the country code. The plugin comes with a single
country code provider which is based on request headers. If you want to create your own provider, all you have to do
is implement the CountryCodeProviderInterface. The service will be
automatically tagged as setono_sylius_geo.country_code_provider
.
NOTE: If you are using Cloudflare all you have to do is within your dashboard go to
Rules > Transform Rules > Managed Transforms
and enable the Add visitor location headers
.
Usage
Redirect visitors based on their country
Go to https://your-store.com/admin/geo/rules/new to create a new rule. Here is an example:
As you can see our goal is to redirect Danish visitors to our locale Danish store. We have excluded bots and our office IP so that bots can freely crawl our international store, and we are able to browse the international store without being redirected, although we are based in Denmark.
Output hreflang
link tags
Add this twig code: {{ ssg_hreflang_tags() }}
to your <head>
section and it will output
<link rel="alternate" hreflang="..." href="...">
tags.
All versions of sylius-geo-plugin with dependencies
doctrine/persistence Version ^2.5 || ^3.2
knplabs/knp-menu Version ^3.3
psr/log Version ^1.1 || ^2.0 || ^3.0
setono/bot-detection-bundle Version ^1.11
setono/composite-compiler-pass Version ^1.1
setono/doctrine-object-manager-trait Version ^1.2
sylius/channel Version ^1.0
sylius/channel-bundle Version ^1.0
sylius/core Version ^1.0
sylius/core-bundle Version ^1.0
sylius/grid-bundle Version ^1.10
sylius/locale Version ^1.0
sylius/locale-bundle Version ^1.0
sylius/resource-bundle Version ^1.8
sylius/ui-bundle Version ^1.0
symfony/config Version ^5.4 || ^6.0
symfony/dependency-injection Version ^5.4 || ^6.0
symfony/event-dispatcher Version ^5.4 || ^6.0
symfony/form Version ^5.4 || ^6.0
symfony/http-foundation Version ^5.4 || ^6.0
symfony/http-kernel Version ^5.4 || ^6.0
symfony/routing Version ^5.4 || ^6.0
twig/twig Version ^2.15 || ^3.7
webmozart/assert Version ^1.11