Download the PHP package hotmeteor/receiver without Composer

On this page you can find all versions of the php package hotmeteor/receiver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package receiver

Receiver

Receiver is a drop-in webhook handling library for Laravel.

Webhooks are a powerful part of any API lifecycle. Receiver aims to make handling incoming webhooks in your Laravel app a consistent and easy process.

Out of the box, Receiver has built in support for:

Of course, Receiver can receive webhooks from any source using custom providers.

Tests Latest Version on Packagist PHP from Packagist

Table of Contents

Installation

Requires:

Optional:

Stripe support requires stripe/stripe-php

Receiving Webhooks

The Basics

Webhooks require an exposed endpoint to POST to. Receiver aims to make this a one-time setup that supports any of your incoming webhooks.

  1. Create a controller and route for the webhooks you expect to receive.
  2. Receive the webhook and handle it, as necessary:

The methods being used are simple:

Receiving from multiple apps

Maybe you have webhooks coming in from multiple services -- handle them all from one controller with a driver variable from your route.

The provided ReceivesWebhooks trait will take care of this for you.

Note: you'll still need to create the route to this action. Example:

Advanced Usage

Fallbacks

Receiver allows you to safely handle webhooks for events you do not handle. Add a fallback method before ok – it takes a callback that is passed the webhook object.

Handling Webhooks

The Basics

Now that webhooks are being received they need to be handled. Receiver will look for designated Handler classes for each event type that comes in in the App\Http\Handlers\[Driver] namespace. Receiver does not provide these handlers -- they are up to you to provide as needed. If Receiver doesn't find a matching handler it simplies ignores the event and responds with a 200 status code.

For example, a Stripe webhook handler would be App\Http\Handlers\Stripe\CustomerCreated for the incoming customer.created event.

Each handler is constructed with the event (name of the webhook event) and data properties.

Each handler must also use the Dispatchable trait.

Queueing Handlers

Of course, since your app may be receiving a lot of webhooks it might be better practice to queue these handlers. That way your app can efficiently respond back to the service that the webhook was received and requests aren't being blocked as events are handled.

Receiver attempts to dispatch every handled event, so queueing handlers is simply a matter of setting them up like any Laravel queued job:

Extending Receiver

As mentioned previously, Receiver can handle webhooks from any source. Even though there are a few providers distributed with the package, Receiver can easily be extended to work with other apps.

Adding Custom Providers

The easiest way to add a new provider is to use the included Artisan command:

This command will generate a new provider with the name you defined. This class will be created in the App\Http\Receivers namespace.

If your provider needs to be able to verify webhook signatures simply add the --verified flag to the command:

Once you've created your new provider you can simply extend Receiver in your AppServiceProvider so that Receiver can use it:

Defining Attributes

Receiver needs two pieces of information to receive and handle webhook events:

Since these are found in different attributes or headers depending on the webhook, Receiver makes it simple ways to define them in your provider.

The getEvent() method is used to return the name of the webhook event, ie. customer.created.

The getData() method is used to return the payload of data that can be used within your handler. By default this is set to $request->all().

Securing Webhooks

Many webhooks have ways of verifying their authenticity as they are received, most commonly through signatures or basic authentication. No matter the strategy, Receiver allows you to write custom verification code as necessary. Simply implement the verify method in your provider and return true or false if it passes.

A false return will result in a 401 response being returned to the webhook sender.

Handshakes

Some webhooks want to perform a "handshake" to check if your endpoint exists and returns a valid response when it's first set up. To facilitate this, implement the handshake method in your provider:

Unlike the verify method, handshake expects an array to be returned, since many times the webhook sender is expecting a specific "challenge" response. The return of the handshake method is sent back to the webhook sender.

Share your Receivers!

Have you created a custom Receiver? Share it with the community in our Receivers Discussion topic!

Credits

Made with contributors-img.

License

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


All versions of receiver with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hotmeteor/receiver contains the following files

Loading the files please wait ....