1. Go to this page and download the library: Download smalot/github-webhook 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/ */
smalot / github-webhook example snippets
est = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();
// Todo: add listener to event dispatcher.
$listener = ...
$dispatcher->addListener(\Smalot\Github\Webhook\Events::WEBHOOK_REQUEST, $listener);
$webhook = new \Smalot\Github\Webhook\Webhook($dispatcher);
$event = $webhook->parseRequest($request, 'password');
namespace AppBundle\Controller;
use Smalot\Github\Webhook\Webhook;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class GithubController extends Controller
{
public function webhookAction(Request $request)
{
$dispatcher = $this->get('event_dispatcher');
$webhook = new Webhook($dispatcher);
$event = $webhook->parseRequest($request, 'password');
return Response('ok');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.