alessandrolandim / paypalbridgebundle
Symfony2 Bundle 创建 PayPal REST SDK 的桥梁
dev-master
2021-12-30 05:08 UTC
Requires
- php: >=5.3.3
- paypal/rest-api-sdk-php: *
Requires (Dev)
- symfony/framework-bundle: >=2.0
This package is auto-updated.
Last update: 2024-09-05 06:24:00 UTC
README
欢迎使用 KMJPayPalBridgeBundle。该 bundle 的目标是提供一种简单的方式将 Paypal SDK 集成到 Symfony 项目中。
- 安装
KMJPayPalBridgeBundle 可以通过 Composer 方便安装。只需将以下内容添加到您的 composer.json 文件中
// composer.json { // ... require: { // .. "paypal/rest-api-sdk-php": "dev-master", "kmj/paypalbridgebundle": "dev-master" } }
然后,您可以通过在 composer.json 文件所在的目录中运行 Composer 的 update 命令来安装新的依赖项
php composer.phar update
现在,Composer 将自动下载所有必要的文件,并为您安装它们。接下来,您需要更新您的 AppKernel.php 文件,并注册新的 bundle
// in AppKernel::registerBundles() $bundles = array( // ... new KMJ\PayPalBridgeBundle\KMJPayPalBridgeBundle(), // ... );
- 用法
KMJPayPalBridgeBundle 作为标准服务调用。
$this->get('paypal')
这将返回一个设置有正确 ini 设置的 paypal SDK 的服务。该服务还包含一个有效的 PayPal\Rest\ApiContext 对象,可以传递给其他 PayPal 对象。此 bundle 还会根据环境自动切换 bundle。生产环境是唯一获取 PayPal 生产端点环境
- 配置
kmj_pay_pal_bridge: environment: sandbox/production //The environment to make the calls to sandbox: clientId: //Client Id provided from developer.paypal.com secret: //Client Secret provided from developer.paypal.com production: clientId: //Client Id provided from developer.paypal.com secret: //Client Secret provided from developer.paypal.com logs: enabled: true //Should logs be used filename: %kernel.root_dir%/logs/paypal.log //the location for the log file level: fine //level of log reporting http: timeout: 30 //The http timeout before an error is generated retry: true //Should the request be tried again if timeout is reached