driveop / stripe-bundle
Stripe API 的简单 Symfony 扩展包。
1.1.4
2020-10-08 17:40 UTC
Requires
- php: >=7.1
- stripe/stripe-php: ^7.27
- symfony/config: ^3.0 || ^4.0
- symfony/dependency-injection: ^3.0 || ^4.0
- symfony/framework-bundle: ^3.0 || ^4.0
- symfony/http-foundation: ^3.0 || ^4.0
- symfony/http-kernel: ^3.0 || ^4.0
- symfony/options-resolver: ^3.0 || ^4.0
- symfony/validator: ^3.0 || ^4.0
README
Stripe API 的简单 Symfony 扩展包。
仅 SMS/WhatsApp!
设置
步骤 1: 使用 composer 下载 DriveOpStripeBundle
在您的 composer.json 中添加 Stripe 扩展包
{ "require": { "driveop/stripe-bundle": "^1.0" } }
现在,运行以下命令让 composer 下载扩展包
$ php composer.phar update "driveop/stripe-bundle"
步骤 2: 启用扩展包
在 kernel 中启用扩展包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new DriveOp\StripeBundle\DriveOpStripeBundle() ); }
步骤 3: 添加配置
# app/config/config.yml driveop: stripe: stripe_private_key: %stripe_private_key%
用法
使用服务
<?php $stripeClient = $this->get('stripe_client'); ?>
##示例
###创建客户 & 订阅
<?php $customer = $stripeClient->createCustomer($token, $email, $name, $phone); // Store customer information $subsciption = $stripeClient->createSubscription($customerId, $planId); // Store subscription information ?>