developmint/netlify-build-hook

轻松触发你的 Netlify 构建钩子

v1.0 2019-08-16 21:53 UTC

This package is auto-updated.

Last update: 2024-09-17 09:12:56 UTC


README

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

此包提供了一个轻量级的类,用于正确触发你的 Netlify 构建钩子

安装

您可以通过 composer 安装此包

composer require developmint/netlify-build-hook

用法

您必须将以下内容传递给 Developmint\NetlifyBuildHook\NetlifyBuildHook 构造函数。

  • Guzzle 客户端
  • 你构建钩子的唯一标识符(构建钩子 URL 的最后一部分)。

最后两个参数是可选的

  • 在 Netlify 上显示的自定义标题
  • 部署应使用的另一个分支
$client = new \GuzzleHttp\Client();
$id = 'XXX'
$hook = new \Developmint\NetlifyBuildHook\NetlifyBuildHook($client, $id);

// Alternatively

// With title
$hook = new \Developmint\NetlifyBuildHook\NetlifyBuildHook($client, $id, 'My custom title');

// With branch
$hook = new \Developmint\NetlifyBuildHook\NetlifyBuildHook($client, $id, null, 'other-branch');

// With everything
$hook = new \Developmint\NetlifyBuildHook\NetlifyBuildHook($client, $id, 'My custom title', 'branch-name');

获取你选择的包的统计数据

使用你类实例的相应 trigger 函数(如上所示)触发钩子。如果发生问题,将抛出 RequestException

$hook->trigger();

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

测试

由于模拟钩子对任何人都没有帮助,并且测试钩子不可用,因此测试并未完全实现。

$ composer test

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件 support@developmint.de 而不是使用问题跟踪器。

鸣谢

许可

MIT 许可证 (MIT)。请参阅 许可文件 了解更多信息。