PHP code example of renttek / bitbucket-webhook-types
1. Go to this page and download the library: Download renttek/bitbucket-webhook-types 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/ */
renttek / bitbucket-webhook-types example snippets
$pullRequestCreatedPayload = '<webhook json here>';
$converter = new \Renttek\BitbucketWebhookTypes\Converter();
$pullRequestCreated = $converter->fromJson(
\Renttek\BitbucketWebhookTypes\EventPayload\PullrequestCreated::class,
$pullRequestCreatedPayload
)
$pullRequestCreatedPayload = '<webhook json here>';
$myAwesomeMapper = (new MapperBuilder())
->supportDateFormats('Y-m-d\TH:i:s.uP')
->infer(
...
)
->registerConstructor(
...
)
->allowSuperfluousKeys()
->mapper();
$converter = new \Renttek\BitbucketWebhookTypes\Converter($myAwesomeMapper);
$pullRequestCreated = $converter->fromJson(
\Renttek\BitbucketWebhookTypes\EventPayload\PullrequestCreated::class,
$pullRequestCreatedPayload
)