nerdysouth/stripe-bundle
Composer 安装命令:
composer require nerdysouth/stripe-bundle
包简介
Stripe Bundle for Symfony 7.2
README 文档
README
Stripe Bundle for Symfony
Description
This bundle helps developers do a Stripe integration in a Symfony application for processing payments. The bundle allows you to generate a redirect URL for one-time or recurring subscription payments, using parameters like success URL, failure URL, amount, and optional product or subscription description. The bundle also adds a route for webhooks and fires a custom event on all webhooks from Stripe, as well as stores Transactions and their status using Doctrine, so that logging and tracking successful payments and subscriptions, and other events, is a breeze.
For now, this bundle allows you to:
- Easily create one-time and subscription payment links
- Listen and handle stripe webhooks as Symfony events
- Log & view successful payments and subscriptions in your database
Next Steps
- Add ability to pass custom metadata into transactions and subscriptions
Installation
Install the stripe-bundle package with composer:
composer require nerdysouth/stripe-bundle
Add the following lines to your config/routes.yaml file (modify the path if you prefer a different path):
nerdysouth_stripe_webhook:
path: /webhook/stripe
controller: NerdySouth\StripeBundle\Controller\StripeWebhookController::handle
methods: [POST]
Add the following lines to your config/packages/doctrine.yaml file:
doctrine:
orm:
mappings:
NerdySouthStripeBundle:
is_bundle: true
type: attribute
dir: Entity
prefix: NerdySouth\StripeBundle\Entity
alias: NerdySouthStripeBundle
Run a doctrine schema update to ensure the additional table is added:
php bin/console doctrine:schema:update -f
Generating Payment Links
Here is an example controller which will redirect the user to your payment page.
<?php
namespace App\Controller;
use NerdySouth\StripeBundle\Service\PaymentService;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Attribute\Route;
class TestController extends AbstractController
{
#[Route('/test', name: 'test')]
public function test(PaymentService $paymentService)
{
return $this->redirect($paymentService->createPaymentUrl(
29.99,
'USD',
'https://www.google.com', // url when successfully paid
'https://www.google.com', // url on cancel or failure
true, // change to false if not a subscription
'Test Product or Subscription'
));
}
}
Event Handling
This bundle dispatches a NerdySouth\StripeBundle\Event\StripeEvent when a webhook is received, with a name that is equal to what Stripe uses as an event "type". For example, values like checkout.session.completed or payment_intent.succeeded - the event has methods like getEventType() and getEventData() to get the event type and the JSON data received in the webhook.
Doing custom code to update your own objects is as simple as creating your own event subscriber which listens for the events you care about.
Support & Contributing
- Please open any issues regarding new features you think would help, or bugs you find in using this application.
Contributions are welcome and encouraged. If you would like to contribute, here is how you can help:
Fork the project. Create a topic branch from master . Make some commits to improve the project. Push this branch to your GitHub project. Open a Pull Request on GitHub. Explain what your code does or how it helps.
nerdysouth/stripe-bundle 适用场景与选型建议
nerdysouth/stripe-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 4, 最近一次更新时间为 2025 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「php」 「bundle」 「stripe」 「webhook」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 nerdysouth/stripe-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nerdysouth/stripe-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 nerdysouth/stripe-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
2lenet/EasyAdminPlusBundle
The bundle for easy using json-rpc api on your project
Provide a way to secure accesses to all routes of an symfony application.
DMS Meetup API Bundle, enables Meetup API clients in services
Bundle Symfony DaplosBundle
Provides a Data Grid tables for your Symfony project.
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-03