1. Go to this page and download the library: Download widop/github-hook-provider library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
php
\Application;
use Widop\GithubHook\GithubHookProvider;
$app = new Application();
$app->register(new GithubHookProvider(), array('github_hook.trusted_ips' => array('127.0.0.1', /* ... */)));
$app->run();
php
\Application;
use Widop\GithubHook\GithubHookProvider;
$githubHookProvider = new GithubHookProvider();
$app = new Application();
$app->register($githubHookProvider, array('github_hook.trusted_ips' => array('127.0.0.1', /* ... */)));
$app->mount('/', $githubHookProvider);
$app->run();
php
// src/Acme/MyHookSubscriber.php
namespace Acme;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Widop\GithubHook\Event\Events;
use Widop\GithubHook\Event\HookEvent;
class MyHookSubscriber implements EventSubscriberInterface
{
public function onHook(HookEvent $event)
{
$hook = $event->getHook();
// Do your stuff...
}
public static function getSubscribedEvents()
{
return array(Events::HOOK => 'onHook');
}
}
php
// src/Acme/MyHookProvider.php
namespace Acme;
use Silex\Application;
use Silex\ServiceProviderInterface;
class MyHookProvider implements ServiceProviderInterface
{
public function boot(Application $app)
{
$app['dispatcher']->addSubscriber(new MyHookSubscriber(/* Injects your own parameters/services */));
}
public function register(Application $app)
{
// Register your own services or simply let it empty :)
}
}
php
$app->register(new Acme\MyHookProvider());
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.