edgarnadal/inbounder

Handle inbound webhooks in organized way

dev-master 2016-12-26 13:47 UTC

This package is not auto-updated.

Last update: 2024-11-19 04:53:08 UTC


README

Scrutinizer Code Quality

This is a laravel package for incoming webhook handling.

Version

v0.1.0

Documentation

Pending for documentation.

Installation

Requirements

  • Laravel 5.1+

Installing with Composer

  1. In your composer.json, add the dependency: "edgarnadal/inbounder": "dev-master"

  2. Add the Inbounder service provider in your config/app.php:

        Inbounder\InbounderServiceProvider::class,
  1. Add the following alias:
        'Inbounder'    => Inbounder\Facades\Inbounder::class,
  1. Create gateways:
php artisan vendor:publish --provider="Inbounder\InbounderServiceProvider"

Add your gateways like this on config/inbounder.php:

    'gateways' => [
        'example-gateway' => 'App\\Example\InbounderHandler'
    ]

Coming soon more on creating handlers.

post('/inbounder/{gateway}', function (\Request $request, $gateway) {

    $gateway = \Inbounder::gateway($gateway, $request);
    $parsed = $gateway->parse();

    dd($parsed);

    $handlerResponse = $parsed->handler()->run();

    // Do something with your handler response, in this case
    // I'll return it to the requester
    return response()->json($handlerResponse);

    // Or you could just return 200
    return response()->make();

});