Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 13 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<img src="http://www.marcelpociot.com/git/hook.png" style="width: 100%" alt="Captain Hook" />

# Captain Hook
## Add Webhooks to your Laravel app, arrr

Expand Down Expand Up @@ -47,8 +48,8 @@ Webhook::create([
- [Using webhooks with multi tenancy](#tenant)
- [License](#license)

<a name="installation" />
## Installation

## <a name="installation" /> Installation

In order to add CaptainHook to your project, just add

Expand All @@ -73,8 +74,7 @@ php artisan vendor:publish --provider="Mpociot\CaptainHook\CaptainHookServicePro
php artisan migrate
```

<a name="usage" />
## Usage
## <a name="usage" /> Usage

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

Expand All @@ -92,8 +92,7 @@ The event that gets called from Laravel will be:

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

<a name="add" />
### Add new webhooks
### <a name="add" /> 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.

Expand All @@ -108,34 +107,29 @@ php artisan hook:add http://www.myapp.com/hook/ 'eloquent.saved: \App\User'

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

<a name="delete" />
### Delete existing webhooks
### <a name="delete" /> 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.

```bash
php artisan hook:delete 2
```

<a name="list" />
### List all active webhooks
### <a name="list" /> List all active webhooks

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

It will output all configured webhooks in a table.

<a name="spark" />
### Spark
### <a name="spark" /> Spark

Install this package like stated in the [Installation section](#installation), then follow the [Spark installation instructions](spark.md).

<a name="listeners" />
### Custom event listeners
### <a name="listeners" /> Custom event listeners

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

<a name="webhook" />
### Receiving a webhook notification
### <a name="webhook" /> Receiving a webhook notification

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

Expand All @@ -147,8 +141,7 @@ $event_json = json_decode($input);
// Do something with $event_json
```

<a name="logging" />
### Webhook logging
### <a name="logging" /> Webhook logging

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

Expand All @@ -158,8 +151,7 @@ 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`.

<a name="tenant" />
### Using webhooks with multi tenancy
### <a name="tenant" /> 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.
Expand Down Expand Up @@ -191,8 +183,7 @@ To return only the webhooks for the currently logged in user, it might look like
},
```

<a name="license" />
## License
## <a name="license" /> License

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

Expand Down