承接 teamup/webhook-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

teamup/webhook-php

最新稳定版本:v1.0.0

Composer 安装命令:

composer require teamup/webhook-php

包简介

Client for receiving and processing Teamup webhook events

README 文档

README

This library provides some auxiliary code to receive, validate and process the data sent by Teamup in a webhook call. You can also check our API Docs for more details related to the API and Webhook itself.

First steps

First of all, you need to create a new webhook in your Teamup calendar.

To achieve that you need to:

Access your calendar > Settings > Navigate to API > Click New Webhook

In the form that will open, enter the information related to the webhook. For local development you can use a tunnel like LocalTunnel to route your localhost deployment.

After configured, you will have access to your secret key. We will need it to verify the integrity of the webhook calls to make sure it is coming from Teamup servers.

Installation

Install the latest version with:

$ composer require teamup/webhook-php

Webhook Implementation

The webhook serving is pretty straight forward. It should not have any heavy computation, the goal is only to receive the Teamup events.

Here you can use some structure to handle events, like Symfony Messenger or Event Dispatcher

A simple implementation may look like:

$webhook = new Webhook(new Parser('my-secret'));

$webhook->registerHandler(Trigger::Any, new MyLogHandler());
$webhook->registerHandler(Trigger::EventCreated, new OnEventCreatedHandler());

$webhook->handle($request);

You can also use directly the parser for a simpler approach:

$content = file_get_contents('php://input');

$parser = new Parser('my-secret');

// should throw InvalidSignatureException if the secret is incorrect or the data is corrupted
$parser->verifyIntegrity(
    $content,
    getRequestHeader(Header::TeamupSignature->value),
);

// If the integrity is verified, you can parse it or just process the raw payload
$payload = $parser->parse($content);

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 6
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-12-16