Download the PHP package alfred-nutile-inc/webhooks without Composer

On this page you can find all versions of the php package alfred-nutile-inc/webhooks. 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 webhooks

Webhooks Package

Install

Setup the provider

'AlfredNutileInc\CoreApp\Webhooks\WebhooksServiceProvider'

Run

php artisan vendor:publish

To publish the mirations

Before you migrate keep reading...

Add to your DatabaseSeeder.php

#database/seeds/DatabaseSeeder.php
/**
 * Used by Webhooks to prevent seed issues
 */
Config::set('seeding', true);

And Webhooks

#database/seeds/DatabaseSeeder.php
Config::set('seeding', true);
$this->call('AppSeeder');
$this->call('WebhooksSeeder');

And copy over vendors/alfred-nutile-inc/webhooks/src/CoreApp/Webhooks/database/seeds/WebhooksSeeder.php to database/seeds

If you want seed data place it in there. There are a couple of examples in there.

@TODO remove the seeder step and make it part of publish

It will end up looking like this

#database/seeds/DatabaseSeeder.php

public function run()
{
    Model::unguard();
    if(Config::get('database.default') != 'sqlite') {
        DB::statement('SET FOREIGN_KEY_CHECKS=0;');
    }

    /**
     * Used by Webhooks to prevent seed issues
     */
    Config::set('seeding', true);
    $this->call('AppSeeder');
    $this->call('WebhooksSeeder');

    Config::set('seeding', false);
    if(Config::get('database.default') != 'sqlite') {
        DB::statement('SET FOREIGN_KEY_CHECKS=1;');
    }
}

Just speeds up seed work as the events are ignored

Now you can migrate

php artisan migrate

Add the commands to your Kernal.php

    protected $commands = [
        'AlfredNutileInc\CoreApp\Webhooks\Console\WebhookAddCommand',
        'AlfredNutileInc\CoreApp\Webhooks\Console\WebhookDeleteCommand'
    ];

Command to add and delete webhooks from the db

Add

php artisan core-app:webhook-add http://full.com/post/path 'event.name In Quotes if needed'

Delete

php artisan core-app:webhook-delete

+--------------------------------------+-----------------------------------------------------------+---------------------------------------------------------+
| id                                   | url                                                       | event                                                   |
+--------------------------------------+-----------------------------------------------------------+---------------------------------------------------------+
| 1bc89184-853b-4ac8-873e-294d7be06ed4 | http://foo.com                                            | eloquent.updated: ScreenShooter\Models\ScreenshooterJob |
| bc4de4e1-b90a-401f-8643-0f5fce4ff00b | http://foo.com                                            | foo                                                     |
| mock-1-webhook                       | https://approve-v2.dev:443/callbacks/screenshot_jobs      | eloquent.updated: ScreenShooter\Models\ScreenshooterJob |
| mock-2-webhook                       | https://approve-v2.dev:443/callbacks/screenshot_jobs_test | eloquent.updated: ScreenShooter\Models\ScreenshooterJob |
+--------------------------------------+-----------------------------------------------------------+---------------------------------------------------------+

To see all you can delete

php artisan core-app:webhook-delete foo-uuid

To delete that uuid

How it works

During an event it will look for listeners in the db and if it finds them it will send the results to that callback.

This is Cached so it only hits the db once UNTIL someone adds a new webhook to listen to.

The callbacks are done asynchronously so the delay should not be long.

Adding more events to listen to

Right now this package only listens to public $listening = ['eloquent.*']; which then searches the Webhooks table for event callbacks.

You can make your own WebhooksWrapper class and extend the WebhooksServiceProvider and add more events. Then register your Provider over the above and they will be added as well.

For example this extends the main provider to listen to other events

Return values

Notes

Move over test with this before going solo on this package


All versions of webhooks with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
laravel/framework Version 5.0.*
fzaninotto/faker Version dev-master
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 alfred-nutile-inc/webhooks contains the following files

Loading the files please wait ....