payplug/sylius-payplug-plugin
Composer 安装命令:
composer require payplug/sylius-payplug-plugin
包简介
PayPlug payment plugin for Sylius applications.
README 文档
README
Payplug payment plugin for Sylius
This plugin allows you to integrate Payplug payment with Sylius platform app including payment features and refunding orders.
Requirements
In the channel settings, the base currency must be set to EUR because the payment gateway only works in this currency.
In local environment, the plugin will not work properly because you will not be notified of the status of payments from the payment gateway.
⚠️ Refunds requirements
You need to make some adjustments in order to make our plugin worked normally due to a dependency to refund-plugin. Please follow those requirements:
To generate "Credit memos" when refunding, your server need to have the WKHTMLTOPDF binary as explain in refund-pluging documentation # Pre-requirements
Compatibility
| Version | |
|---|---|
| PHP | ^8.2 |
| Sylius | ^2.0 |
With Symfony Flex
1. Allow contrib recipes and require the plugin
composer config extra.symfony.allow-contrib true
composer require payplug/sylius-payplug-plugin
2. Install the Flex recipe
composer recipes:install payplug/sylius-payplug-plugin --force
This automatically registers the bundle, copies configuration files, and sets up assets (on Sylius 2.1+).
3. Apply migrations to your database
bin/console doctrine:migrations:migrate
4. Add Payplug to refundable payment methods for Sylius Refund Plugin in config/services.yaml
parameters: locale: fr_FR sylius_refund.supported_gateways: - payplug - payplug_oney - payplug_bancontact - payplug_apple_pay - payplug_american_express
5. Add Traits for Customer and PaymentMethod entities
- App\Entity\Customer\Customer
<?php declare(strict_types=1); namespace App\Entity\Customer; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\CardsOwnerInterface; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\CustomerTrait; use Sylius\Component\Core\Model\Customer as BaseCustomer; /** * @ORM\Entity * @ORM\Table(name="sylius_customer") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_customer')] class Customer extends BaseCustomer implements CardsOwnerInterface { use CustomerTrait; }
- App\Entity\Payment\PaymentMethod
<?php declare(strict_types=1); namespace App\Entity\Payment; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentMethodTrait; use Sylius\Component\Core\Model\PaymentMethod as BasePaymentMethod; use Sylius\Component\Payment\Model\PaymentMethodTranslationInterface; /** * @ORM\Entity * @ORM\Table(name="sylius_payment_method") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_payment_method')] class PaymentMethod extends BasePaymentMethod { use PaymentMethodTrait; protected function createTranslation(): PaymentMethodTranslationInterface { return new PaymentMethodTranslation(); } }
- App\Entity\Payment\Payment
<?php declare(strict_types=1); namespace App\Entity\Payment; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; use PayPlug\SyliusPayPlugPlugin\Entity\Traits\PaymentTrait; use Sylius\Component\Core\Model\Payment as BasePayment; /** * @ORM\Entity * @ORM\Table(name="sylius_payment") */ #[ORM\Entity] #[ORM\Table(name: 'sylius_payment')] class Payment extends BasePayment { use PaymentTrait; }
6. Process translations
php bin/console translation:extract en PayPlugSyliusPayPlugPlugin --dump-messages php bin/console translation:extract fr PayPlugSyliusPayPlugPlugin --dump-messages
7. Clear cache
bin/console cache:clear
🎉 You are now ready to add Payplug Payment method.
In your back-office, go to Configuration > Payment methods, then click on Create and choose "Payplug".
Logs
If you want to follow the logs in the production environment, you need to add the configuration in config/packages/prod/monolog.yaml, logs should be in var/log/prod.log which can be searched after the phrase [Payum] or [Payplug]:
monolog: handlers: ... payum: level: debug type: stream path: "%kernel.logs_dir%/%kernel.environment%.log"
Customization
Available services you can decorate and forms you can extend
Run the below command to see what Symfony services are shared with this plugin:
$ bin/console debug:container payplug_sylius_payplug_plugin
Development
See How to contribute.
License
This library is under the MIT license.
Oney Integration
For better Oney integration, you can check the Oney enhancement documentation.
Authorized Payment
Since 1.11.0, the plugin supports the authorized payment feature. You can check the Authorized Payment documentation.
Doc
payplug/sylius-payplug-plugin 适用场景与选型建议
payplug/sylius-payplug-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 77.83k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2020 年 05 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sylius」 「payplug」 「sylius-plugin」 「symfony-ux」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 payplug/sylius-payplug-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 payplug/sylius-payplug-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 payplug/sylius-payplug-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Implementation of the Omnibus Directive for Sylius application.
Bulk export of sylius resources
Sylius plugin that integrates Addwish
Setono example plugin for Sylius.
Will translate fragments of text automatically
Use price tiers in your Sylius store.
统计信息
- 总下载量: 77.83k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-14