setono / sylius-review-plugin
Send review requests to your customers
Fund package maintenance!
Setono
Installs: 1 855
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
Type:sylius-plugin
pkg:composer/setono/sylius-review-plugin
Requires
- php: >=8.1
- doctrine/orm: ^2.0
- doctrine/persistence: ^2.0 || ^3.0
- ocramius/doctrine-batch-utils: ^2.4
- psr/event-dispatcher: ^1.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- setono/composite-compiler-pass: ^1.1
- setono/doctrine-orm-trait: ^1.0.1
- sylius/core: ^1.0
- sylius/core-bundle: ^1.0
- sylius/mailer-bundle: ^1.8 || ^2.0
- sylius/order: ^1.0
- sylius/resource-bundle: ^1.6
- symfony/config: ^5.4 || ^6.4 || ^7.0
- symfony/console: ^5.4 || ^6.4 || ^7.0
- symfony/dependency-injection: ^5.4 || ^6.4 || ^7.0
- symfony/event-dispatcher: ^5.4 || ^6.4 || ^7.0
- symfony/http-kernel: ^5.4 || ^6.4 || ^7.0
- symfony/workflow: ^5.4 || ^6.4 || ^7.0
- webmozart/assert: ^1.11
Requires (Dev)
- api-platform/core: ^2.7.16
- babdev/pagerfanta-bundle: ^3.8
- behat/behat: ^3.14
- doctrine/doctrine-bundle: ^2.11
- infection/infection: ^0.27.10
- jms/serializer-bundle: ^4.2
- lexik/jwt-authentication-bundle: ^2.17
- matthiasnoback/symfony-dependency-injection-test: ^4.3 || ^5.1
- phpunit/phpunit: ^9.6.17
- psalm/plugin-phpunit: ^0.18.4
- setono/code-quality-pack: ^2.7
- sylius/sylius: ~1.12.13
- symfony/debug-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/dotenv: ^5.4 || ^6.4 || ^7.0
- symfony/intl: ^5.4 || ^6.4 || ^7.0
- symfony/property-info: ^5.4 || ^6.4 || ^7.0
- symfony/serializer: ^5.4 || ^6.4 || ^7.0
- symfony/web-profiler-bundle: ^5.4 || ^6.4 || ^7.0
- symfony/webpack-encore-bundle: ^1.17.2
- synolia/sylius-mail-tester-plugin: ^2.4
- willdurand/negotiation: ^3.1
This package is auto-updated.
Last update: 2026-02-16 13:55:06 UTC
README
Send review requests to your customers to receive reviews for your store.
The process command finds fulfilled orders without review requests and creates them automatically.
After an initial delay (configurable), it sends a review request email to each customer.
Before sending, the plugin runs an eligibility check. You can hook into this process to decide whether a review request should be sent or not.
Installation
composer require setono/sylius-review-plugin
Add plugin class to your bundles.php:
<?php $bundles = [ // ... Setono\SyliusReviewPlugin\SetonoSyliusReviewPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
Make sure you add it before SyliusGridBundle, otherwise you'll get
You have requested a non-existent parameter "setono_sylius_review.model.review_request.class". exception.
Extend the Channel entity (for store reviews)
If you want to use store reviews, you need to extend the Channel entity to implement ReviewableInterface. The plugin provides a trait to make this easy.
Create src/Entity/Channel.php:
<?php declare(strict_types=1); namespace App\Entity\Channel; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Setono\SyliusReviewPlugin\Model\ChannelInterface; use Setono\SyliusReviewPlugin\Model\ChannelTrait; use Setono\SyliusReviewPlugin\Model\StoreReviewInterface; use Sylius\Component\Core\Model\Channel as BaseChannel; use Sylius\Component\Review\Model\ReviewInterface; #[ORM\Entity] #[ORM\Table(name: 'sylius_channel')] class Channel extends BaseChannel implements ChannelInterface { use ChannelTrait; public function __construct() { parent::__construct(); $this->reviews = new ArrayCollection(); } }
Then configure Sylius to use your custom Channel entity in config/packages/sylius_channel.yaml:
sylius_channel: resources: channel: classes: model: App\Entity\Channel\Channel
Update your database
php bin/console doctrine:migrations:diff php bin/console doctrine:migrations:migrate
Run commands
There are two commands in this plugin. One for creating and processing review requests and one for pruning the review request table.
php bin/console setono:sylius-review:process php bin/console setono:sylius-review:prune
The process command does two things:
- Creates review requests for fulfilled orders that don't have one yet (looking back as far as the
pruning.threshold) - Processes pending review requests (eligibility check + sending emails)
You decide yourself how often you want to run these commands. The process command makes sense to run daily, while the prune command can be run weekly or monthly.
Configuration
setono_sylius_review: eligibility: # The initial delay before the first eligibility check. The string must be parseable by strtotime(). See https://www.php.net/strtotime initial_delay: '+1 week' # The maximum number of eligibility checks before the review request is automatically cancelled maximum_checks: 5 pruning: # Review requests older than this threshold will be pruned/removed. The string must be parseable by strtotime(). See https://www.php.net/strtotime threshold: '-1 month' resources: review_request: options: ~ classes: model: Setono\SyliusReviewPlugin\Model\ReviewRequest repository: Setono\SyliusReviewPlugin\Repository\ReviewRequestRepository factory: Sylius\Component\Resource\Factory\Factory
Add eligibility checker
You can add your own eligibility checker by implementing the Setono\SyliusReviewPlugin\EligibilityChecker\ReviewRequestEligibilityCheckerInterface.
<?php use Setono\SyliusReviewPlugin\EligibilityChecker\EligibilityCheck; use Setono\SyliusReviewPlugin\EligibilityChecker\ReviewRequestEligibilityCheckerInterface; final class MyEligibilityChecker implements ReviewRequestEligibilityCheckerInterface { public function check(ReviewRequestInterface $reviewRequest): EligibilityCheck { if($this->getCustomer()->hasGreenEyes()) { return EligibilityCheck::ineligible('The review request is not eligible because we don't trust people with green eyes...'); } return EligibilityCheck::eligible(); } }
When you implement the interface, your service will automatically be added to the list of eligibility checkers.
However, if you don't use autoconfiguration, you need to tag your service with setono_sylius_review.review_request_eligibility_checker.
Mail tester plugin
If you use the mail tester plugin you can test the review request email
directly from the admin interface. Just go to https://your-store.com/admin/mail/tester
and select the setono_sylius_review__review_request in the Subjects dropdown.