2017 © Pedro Peláez
 

library php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

image

teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  • Saturday, July 14, 2018
  • by TeamTNT
  • Repository
  • 5 Watchers
  • 67 Stars
  • 18,020 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 1 Open issues
  • 7 Versions
  • 10 % Grown

The README.md

PHP Stripe Webhook Tester

Latest Version Software License Build Status Quality Score Total Downloads, (*1)

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., (*2)

Install

Via Composer, (*3)

``` bash $ composer require TeamTNT/php-stripe-webhook-tester, (*4)


## 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, (*5)

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

## Laravel Integration 
To implement this package with [Laravel Cashier](http://laravel.com/docs/5.1/billing), 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., (*7)

Available versions and events

Available versions and events can be found in the webhooks directory, (*8)

Testing

bash $ phpunit, (*9)

Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

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

The Versions

14/07 2018

dev-master

9999999-dev https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

14/07 2018

v1.1.3

1.1.3.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

28/02 2018

v1.1.2

1.1.2.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

10/03 2016

v1.1.1

1.1.1.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

10/03 2016

v1.1

1.1.0.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

31/03 2015

v1.0.1

1.0.1.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester

31/03 2015

v1.0.0

1.0.0.0 https://github.com/teamtnt/php-stripe-webhook-tester

A PHP package for testing Stripe Webhooks localy

  Sources   Download

MIT

The Requires

 

The Development Requires

teamtnt php-stripe-webhook-tester