Download the PHP package minkbear/captainhook without Composer

On this page you can find all versions of the php package minkbear/captainhook. 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 captainhook

Captain Hook

Captain Hook

Add Webhooks to your Laravel app, arrr

image image codecov.io Scrutinizer Code Quality Build Status StyleCI

Implement multiple webhooks into your Laravel app using the Laravel Event system.

Examples

Contents

Installation

In order to add CaptainHook to your project, just add

"mpociot/captainhook": "~2.0"

to your composer.json's require block. Then run composer install or composer update.

Or run composer require mpociot/captainhook if you prefer that.

Then in your config/app.php add

Mpociot\CaptainHook\CaptainHookServiceProvider::class

to the providers array.

Publish and run the migration to create the "webhooks" table that will hold all installed webhooks.

Usage

The CaptainHook service provider listens for any eloquent.* events.

If the package finds a configured webhook for an event, it will make a POST request to the specified URL.

Webhook data is sent as JSON in the POST request body. The full event object is included and can be used directly, after parsing the JSON body.

Example

Let's say you want to have a webhook that gets called every time your User model gets updated.

The event that gets called from Laravel will be:

eloquent.updated: \App\User

So this will be the event you want to listen for.

Add new webhooks

If you know which event you want to listen to, you can add a new webhook by using the hook:add artisan command.

This command takes two arguments:

  • The webhook URL that will receive the POST requests
  • The event name. This could either be one of the eloquent.* events, or one of your custom events.

You can also add multiple webhooks for the same event, as all configured webhooks will get called asynchronously.

Delete existing webhooks

To remove an existing webhook from the system, use the hook:delete command. This command takes the webhook ID as an argument.

List all active webhooks

To list all existing webhooks, use the hook:list command.

It will output all configured webhooks in a table.

Spark

Install this package like stated in the Spark installation instructions.

Custom event listeners

All listeners are defined in the config file located at config/captain_hook.php.

Receiving a webhook notification

To receive the event data in your configured webhook, use:

Webhook logging

Starting with version 2.0, this package allows you to log the payload and response of the triggered webhooks.

NOTE: A non-blocking queue driver (not sync) is highly recommended. Otherwise your application will need to wait for the webhook execution.

You can configure how many logs will be saved per webhook (Default 50).

This value can be modified in the configuration file config/captain_hook.php.

Using webhooks with multi tenancy

Sometimes you don't want to use system wide webhooks, but rather want them scoped to a specific "tenant". This could be bound to a user or a team.

The webhook table has a field tenant_id for this purpose. So if you want your users to be able to add their own webhooks, you won't use the artisan commands to add webhooks to the database, but add them on your own.

To add a webhook that is scoped to the current user, you could do for example:

Now when you fire this event, you want to call the webhook only for the currently logged in user.

In order to filter the webhooks, modify the filter configuration value in the config/captain_hook.php file. This filter is a Laravel collection filter.

To return only the webhooks for the currently logged in user, it might look like this:

License

CaptainHook is free software distributed under the terms of the MIT license.

'Day 02: Table, Lamp & Treasure Map' image licensed under Creative Commons 2.0 - Photo from stevedave


All versions of captainhook with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/support Version ~5.0
guzzlehttp/guzzle Version ~6.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 minkbear/captainhook contains the following files

Loading the files please wait ....