2017 © Pedro PelĂĄez
 

library bitbucket-webhook

Bitbucket API to handle webhook callbacks.

image

smalot/bitbucket-webhook

Bitbucket API to handle webhook callbacks.

  • Tuesday, January 5, 2016
  • by smalot
  • Repository
  • 1 Watchers
  • 6 Stars
  • 101 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 16 % Grown

The README.md

Bitbucket - Webhook

Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality, (*1)

Requirements

  • PHP 5.3+
  • symfony/http-foundation >= 2.3
  • symfony/event-dispatcher >= 2.3

Installation

Composer

You need first to download this library using composer., (*2)

composer require smalot/bitbucket-webhook

Go to GetComposer.org to install Composer on your environment., (*3)

Example

From scratch

<?php

require_once 'vendor/autoload.php';

$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
$dispatcher = new \Symfony\Component\EventDispatcher\EventDispatcher();

// Todo: add listener to event dispatcher.
$listener = ...

$dispatcher->addListener(\Smalot\Bitbucket\Webhook\Events::WEBHOOK_REQUEST, $listener);
$webhook = new \Smalot\Bitbucket\Webhook\Webhook($dispatcher);
$event = $webhook->parseRequest($request);

Using Symfony in controller

<?php

namespace AppBundle\Controller;

use Smalot\Bitbucket\Webhook\Webhook;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class BitbucketController extends Controller
{
    public function webhookAction(Request $request)
    {
        $dispatcher = $this->get('event_dispatcher');
        $webhook = new Webhook($dispatcher);
        $event = $webhook->parseRequest($request);

        return Response('ok');
    }
}

Don't forget to previously to register any event listener., (*4)

Documentation

Remote API

https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html, (*5)

Security

Bitbucket whitelist IP ranges:, (*6)

https://confluence.atlassian.com/bitbucket/manage-webhooks-735643732.html#Managewebhooks-trigger_webhook, (*7)

````` 131.103.20.160/27 165.254.145.0/26 104.192.143.0/24 ````, (*8)

Events

https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html, (*9)

The Versions

05/01 2016

dev-master

9999999-dev

Bitbucket API to handle webhook callbacks.

  Sources   Download

MIT

The Requires

 

05/01 2016

v0.2

0.2.0.0

Bitbucket API to handle webhook callbacks.

  Sources   Download

MIT

The Requires

 

05/01 2016

v0.1

0.1.0.0

Bitbucket API to handle webhook callbacks.

  Sources   Download

MIT

The Requires