Trustpilot plugin for Sylius.

Installs: 17 465

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 3

Forks: 3

Open Issues: 8



Latest Version Latest Unstable Version Software License Build Status Quality Score

Send follow up emails to your customers to entice them to leave feedback for you. The plugin uses Trustpilots AFS service.


Install plugin using composer:

$ composer require setono/sylius-trustpilot-plugin

Add bundle to config/bundles.php:

// config/bundles.php

return [
    // ...
    Setono\SyliusTrustpilotPlugin\SetonoSyliusTrustpilotPlugin::class => ['all' => true],

Add plugin routing to application:

# config/routes/setono_sylius_trustpilot.yaml
    resource: "@SetonoSyliusTrustpilotPlugin/Resources/config/admin_routing.yaml"
    prefix: /admin

Override Customer and Order entities:

Read the docs regarding customizing models.

Here are the plugin specific changes you need to make in order to make this plugin work:

// src/Entity/Customer.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusTrustpilotPlugin\Model\CustomerTrustpilotAwareInterface;
use Setono\SyliusTrustpilotPlugin\Model\CustomerTrait as TrustpilotCustomerTrait;
use Sylius\Component\Core\Model\Customer as BaseCustomer;

 * @ORM\Table(name="sylius_customer")
 * @ORM\Entity()
class Customer extends BaseCustomer implements CustomerTrustpilotAwareInterface
    use TrustpilotCustomerTrait;
// src/Entity/Order.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Setono\SyliusTrustpilotPlugin\Model\OrderTrustpilotAwareInterface;
use Setono\SyliusTrustpilotPlugin\Model\OrderTrait as TrustpilotOrderTrait;
use Sylius\Component\Core\Model\Order as BaseOrder;

 * @ORM\Table(name="sylius_order")
 * @ORM\Entity()
class Order extends BaseOrder implements OrderTrustpilotAwareInterface
    use TrustpilotOrderTrait;

Add overrides configuration:

# config/packages/setono_sylius_trustpilot.yml
    - { resource: "@SetonoSyliusTrustpilotPlugin/Resources/config/app/config.yaml" }

                model: App\Entity\Customer
                # If you already have your own CustomerController - use TrustpilotCustomerTrait instead
                controller: Setono\SyliusTrustpilotPlugin\Controller\CustomerController
                model: App\Entity\Order

Add plugin configuration:

# config/packages/setono_sylius_trustpilot.yml

    # Mandatory.
    # Bcc Trustpilot email from
    trustpilot_email: "%env(APP_TRUSTPILOT_EMAIL)%"

    # Optional. Default value - 7.
    # How many days after the order was completed Customer's email should be sent to Trustpilot
    send_in_days: 7

    # Optional. Default value - send_in_days + 2.
    # If you decrease send_in_days on live project, you should keep
    # process_latest_days old value for more than that amount of days.
    # For example, if you had send_in_days: 7 and changed to
    # send_in_days: 3, then you should keep process_latest_days: 9 (7+2)
    # for at least next 10 days after this change
    # After 10 days gone, you can remove this parameter from your configuration
    process_latest_days: 9

    # Optional. Default value - 0
    # (meaning that the customer will receive an invite every time he makes an order)
    # How many invites a Customer should receive before never asking him again
    invites_limit: 0

Put environment variable to .env

###> setono/sylius-trustpilot-plugin ###
###< setono/sylius-trustpilot-plugin ###

Update your schema (for existing project)

# Generate and edit migration
bin/console doctrine:migrations:diff

# Then apply migration
bin/console doctrine:migrations:migrate

Production notes

Make sure you configured next command to be executed on daily basis (with CRON):

bin/console setono:sylius-trustpilot:process --env=prod

Keep in mind this command probably should be executed in most active time of day for your customers, e.g. not at 3:00.


Add custom OrderEligibilityChecker

Write your custom class implementing OrderEligibilityCheckerInterface:

Lets assume we don't want feedback for order less than $100.

class CustomOrderEligibilityChecker implements OrderEligibilityCheckerInterface
    public function isEligible(OrderInterface $order): bool
        return $order->getTotal() >= 10000;

Tag it with setono_sylius_trustpilot.order_eligibility_checker tag

    <service id="App\Trustpilot\Order\EligibilityChecker\CustomOrderEligibilityChecker">
        <tag name="setono_sylius_trustpilot.order_eligibility_checker" />


Please run composer all to run all checks and tests before making PR or pushing changes to repo.

Running plugin tests

  • PHPSpec

    $ composer phpspec
  • Behat

    $ composer behat
  • All tests (phpspec & behat)

    $ composer test