societe-des-avis-garantis/sylius-sag-plugin
Composer 安装命令:
composer require societe-des-avis-garantis/sylius-sag-plugin
包简介
Product review integration for Société des Avis Garantis.
README 文档
README
Plugin SAG
Sylius SAG plugin by Dedi. Product review integration for Société des Avis Garantis
About Dedi
At Dedi, we do not just create websites. We are building together a real digital strategy to combine your business requirements with our technical skills. We've been working with open source for a long time and decided to start giving back to the community by contributing and sharing some plugin of our own.
We’ll be happy to meet you, feel free to contact us. Learn more about us on our website.
Table of Content
- Installation
- Configure Product
- Configure Product Review
- Configure Order
- Configure Channel
- Migrations
- Templates
- Overview
Installation
Require plugin with composer:
composer require societe-des-avis-garantis/sylius-sag-plugin --no-scripts
Symfony Flex will automatically register and configure the config/bundles.php file to add the line for the plugin :
<?php return [ //.. Dedi\SyliusSAGPlugin\DediSyliusSAGPlugin::class => ['all' => true], ];
- Create a
dedi_sag_plugin.yamlfile intoconfig/packagesfolder to import required config
# config/packages/dedi_sag_plugin.yaml imports: - { resource: "@DediSyliusSAGPlugin/Resources/config/config.yml" }
- Add the plugin routes to your config.
# config/routes.yaml dedi_sylius_sag_shop: resource: "@DediSyliusSAGPlugin/Resources/config/shop_routing.yml" prefix: /{_locale} requirements: _locale: ^[a-z]{2}(?:_[A-Z]{2})?$ dedi_sylius_sag_admin: resource: "@DediSyliusSAGPlugin/Resources/config/admin_routing.yml" prefix: /admin dedi_sylius_sag_api: resource: "@DediSyliusSAGPlugin/Resources/config/api_routing.yml" prefix: /sag-api
Configure Product
Your Product entity needs to implement the Dedi\SyliusSAGPlugin\Entity\Product\ProductInterface interface and use the Dedi\SyliusSAGPlugin\Entity\Product\ProductTrait trait.
<?php declare(strict_types=1); namespace App\Entity\Product; use Dedi\SyliusSAGPlugin\Entity\Product\ProductInterface as DediSAGProductInterface; use Dedi\SyliusSAGPlugin\Entity\Product\ProductTrait as DediSAGProductTrait; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Product as BaseProduct; /** * @ORM\Entity * @ORM\Table(name="sylius_product") */ class Product extends BaseProduct implements DediSAGProductInterface { use DediSAGProductTrait; }
Configure ProductReview
Your ProductReview entity needs to implement the Dedi\SyliusSAGPlugin\Entity\Review\ProductReviewInterface interface and use the Dedi\SyliusSAGPlugin\Entity\Review\ProductReviewTrait trait.
<?php declare(strict_types=1); namespace App\Entity\Product; use Dedi\SyliusSAGPlugin\Entity\Review\ProductReviewInterface as DediSAGProductReviewInterface; use Dedi\SyliusSAGPlugin\Entity\Review\ProductReviewTrait as DediSAGProductReviewTrait; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\ProductReview as BaseProductReview; /** * @ORM\Entity * @ORM\Table(name="sylius_product_review") */ class ProductReview extends BaseProductReview implements DediSAGProductReviewInterface { use DediSAGProductReviewTrait; public function setId(?int $id): void { $this->id = $id; } }
Your ProductReviewRepository repository needs to implement the Dedi\SyliusSAGPlugin\Repository\Review\ProductReviewRepositoryInterface interface and use the Dedi\SyliusSAGPlugin\Repository\Review\ProductReviewRepositoryTrait trait.
<?php declare(strict_types=1); namespace App\Repository\Review; use Dedi\SyliusSAGPlugin\Repository\Review\ProductReviewRepositoryInterface as DediSAGProductReviewRepositoryInterface; use Dedi\SyliusSAGPlugin\Repository\Review\ProductReviewRepositoryTrait as DediSAGProductReviewRepositoryTrait; use Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductReviewRepository as BaseProductReviewRepository; final class ProductReviewRepository extends BaseProductReviewRepository implements DediSAGProductReviewRepositoryInterface { use DediSAGProductReviewRepositoryTrait; }
Don't forget to update the Sylius resource config accordingly.
# config/_sylius.yaml sylius_review: resources: product: review: classes: model: App\Entity\Product\ProductReview repository: App\Repository\Review\ProductReviewRepository reviewer: classes: # configure the reviewer with this entity otherwise it will use the Customer entity model: Sylius\Component\Review\Model\Reviewer
Your ProductReviewFactory should implement Dedi\SyliusSAGPlugin\Factory\Review\ReviewFactoryInterface and use the Dedi\SyliusSAGPlugin\Factory\Review\ReviewFactoryTrait trait.
<?php declare(strict_types=1); namespace App\Factory\Review; use Dedi\SyliusSAGPlugin\Factory\Review\ReviewFactoryInterface as DediSAGReviewFactoryInterface; use Dedi\SyliusSAGPlugin\Factory\Review\ReviewFactoryTrait as DediSAGReviewFactoryTrait; use Sylius\Component\Resource\Factory\FactoryInterface; use Sylius\Component\Review\Factory\ReviewFactoryInterface; use Sylius\Component\Review\Model\ReviewableInterface; use Sylius\Component\Review\Model\ReviewerInterface; use Sylius\Component\Review\Model\ReviewInterface; final class ReviewFactory implements DediSAGReviewFactoryInterface { use DediSAGReviewFactoryTrait { __construct as initializeDediSAGArguments; } /** @var ReviewFactoryInterface */ private $baseFactory; public function __construct( ReviewFactoryInterface $baseFactory, FactoryInterface $reviewerFactory ) { $this->baseFactory = $baseFactory; $this->initializeDediSAGArguments($reviewerFactory); } public function createNew() { return $this->baseFactory->createNew(); } public function createForSubject(ReviewableInterface $subject): ReviewInterface { return $this->baseFactory->createForSubject($subject); } public function createForSubjectWithReviewer(ReviewableInterface $subject, ?ReviewerInterface $reviewer): ReviewInterface { return $this->baseFactory->createForSubjectWithReviewer($subject, $reviewer); } }
Don't forget to add the corresponding service.
# config/services.yaml services: app.factory.product_review: class: App\Factory\Review\ReviewFactory decorates: sylius.factory.product_review arguments: $baseFactory: '@app.factory.product_review.inner' $reviewerFactory: '@sylius.factory.product_reviewer' public: false
Configure Order
Your OrderRepository repository needs to implement the Dedi\SyliusSAGPlugin\Repository\Order\OrderRepositoryInterface interface and use the Dedi\SyliusSAGPlugin\Repository\Order\OrderRepositoryTrait trait.
<?php declare(strict_types=1); namespace App\Repository\Order; use Dedi\SyliusSAGPlugin\Repository\Order\OrderRepositoryInterface as DediSAGOrderRepositoryInterface; use Dedi\SyliusSAGPlugin\Repository\Order\OrderRepositoryTrait as DediSAGOrderRepositoryTrait; use Sylius\Bundle\CoreBundle\Doctrine\ORM\OrderRepository as BaseOrderRepository; class OrderRepository extends BaseOrderRepository implements DediSAGOrderRepositoryInterface { use DediSAGOrderRepositoryTrait; }
Don't forget to update the Sylius resource config accordingly.
# config/_sylius.yaml sylius_order: resources: order: classes: repository: App\Repository\Order\OrderRepository
Configure Channel
Your Channel entity needs to implement the Dedi\SyliusSAGPlugin\Entity\Channel\ChannelInterface interface and use the Dedi\SyliusSAGPlugin\Entity\Channel\ChannelTrait trait.
<?php declare(strict_types=1); namespace App\Entity\Channel; use Dedi\SyliusSAGPlugin\Entity\Channel\ChannelInterface as DediSAGChannelInterface; use Dedi\SyliusSAGPlugin\Entity\Channel\ChannelTrait as DediSAGChannelTrait; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Channel as BaseChannel; /** * @ORM\Entity * @ORM\Table(name="sylius_channel") */ class Channel extends BaseChannel implements DediSAGChannelInterface { use DediSAGChannelTrait; }
Create migration
Migrations are already provided by the plugin itself.
bin/console doctrine:migration:migrate
Templates
Override sylius default templates.
cp -R vendor/dedi/sylius-sag-plugin/tests/Application/templates/* templates/
Overview
Product Index
This plugin adds the following features to your shop:
- Javascript widget
- Iframe widget
- footer certificate link
Product Show
On your product page, you will retrieve reviews from Societé des Avis Garantis with some statistics.
Admin Key Index
In the back office, a new entry "SAG Api keys" allows you to configure your shop with Société des Avis Garantis api.
Admin Channel configuration
The channel configuration form gets a new section where you can enable or disable the following parts on your shop:
- Javascript widget
- Iframe widget
- footer certificate link
Admin Reviews
Reviews are now not editable in the back office to comply with Société des Avis Garantis requirements.
societe-des-avis-garantis/sylius-sag-plugin 适用场景与选型建议
societe-des-avis-garantis/sylius-sag-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 08 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sylius」 「reviews」 「sag」 「opinion」 「sylius-plugin」 「avis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 societe-des-avis-garantis/sylius-sag-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 societe-des-avis-garantis/sylius-sag-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 societe-des-avis-garantis/sylius-sag-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Implementation of the Omnibus Directive for Sylius application.
Bulk export of sylius resources
Sylius plugin that integrates Addwish
Ratings Plugin for CakePHP.
Setono example plugin for Sylius.
Will translate fragments of text automatically
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-03





