百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

php-stripe-webhook-tester

> 编程语言
开源

一个用于本地测试 Stripe Webhooks 的 PHP 包

100 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

一个用于本地测试 Stripe Webhooks 的 PHP 包

PHP Stripe Webhook Tester

The goal of this package is to make testing stripe webhooks easy on a local machine without the use of ngrok or other similar tunneling services. The package will simulate a post request to a specified endpoint with a json containing event data and make sure that your application reacts accordingly.

Install

Via Composer

bash
$ composer require TeamTNT/php-stripe-webhook-tester

Usage

php
$tester = new TeamTNT\Stripe\WebhookTester();
$tester->setVersion('2018-05-21');
$tester->setEndpoint('http://local.dev/stripe/webhooks');

$response = $tester->triggerEvent('charge.succeeded');

For your convenience you can use chained methods

php
$tester = new TeamTNT\Stripe\WebhookTester('http://local.dev/stripe/webhooks);
$response = $tester->setVersion('2014-09-08')->triggerEvent('charge.succeeded');

Laravel Integration

To implement this package with Laravel Cashier, you will need to override the eventExistsOnStripe() method in Laravel\Cashier\WebhookController with something like this:

php
protected function eventExistsOnStripe($id)
{
    if(App::environment() == 'testing' or App::environment() == 'local') {
        return true;
    }
    try {
        return ! is_null(StripeEvent::retrieve($id, Config::get('services.stripe.secret')));
    } catch (Exception $e) {
        return false;
    }
}

Without the environment checks Cashier attempts to verify that the dummy event is a valid webhook with Stripe, which will obviously fail.

Available versions and events

Available versions and events can be found in the webhooks directory

Testing

bash
$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

  • Nenad Ticaric
  • Sasa Tokic
  • Jesse Schutt
  • All Contributors

License

The MIT License (MIT). Please see License File for more information.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHP

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言