vdhicts/nuclino-api-client

Nuclino API 的客户端

v3.0.0 2024-03-17 07:10 UTC

This package is auto-updated.

Last update: 2024-09-17 08:26:36 UTC


README

一个易于使用的 Nuclino API 客户端。[a href="https://www.nuclino.com/" rel="nofollow noindex noopener external ugc">Nuclino 的 API。

要求

此包需要至少 PHP 8.1。

安装

此包可以在任何 PHP 项目或框架中使用。

您可以通过 composer 安装此包

composer require vdhicts/nuclino-api-client

使用

此包只是使用 Nuclino API 的简单客户端。有关响应的更多信息,请参阅 API 文档

入门

// Initialize the API
$api = new \Vdhicts\Nuclino\Nuclino($apiKey);

// List the items
$response = $api->listItems();

if ($response->ok()) {
    $response->json('data');
}

处理错误

将始终返回一个 Response 对象。请参阅 Http Client 的 错误处理

if ($response->failed()) {
    var_dump($response->serverError());
}

Laravel

此包可以轻松地用于任何 Laravel 应用程序。我建议将凭据添加到项目的 .env 文件中

NUCLINO_API_KEY=apikey

接下来,在 /config 中创建一个配置文件 nuclino.php

<?php

return [
    'api_key' => env('NUCLINO_API_KEY'),
];

并为客户端提供 API 密钥

$api = new \Vdhicts\Nuclino\Nuclino(config('nuclino.api_key'));

将来我可能会制作一个特定的 Laravel 包,它将使用此包。

测试

单元测试在 tests 文件夹中可用。运行

composer test

当您想要一个代码覆盖率报告时,该报告将在 build/report 文件夹中生成。运行

composer test-coverage

贡献

欢迎任何贡献,但它应满足 PSR-12 标准,并请为每个功能/错误创建一个 pull request。作为交换,您将被列为贡献者。

安全性

如果您在此或 Vdhicts 的其他包中发现任何与安全相关的问题,请通过电子邮件 info@vdhicts.nl 而不是使用问题跟踪器。

支持

此包不是 Nuclino 的官方包,因此他们可能不会提供对其的支持。如果您遇到此客户端的问题或对此有任何疑问,请随时在 GitHub 上打开一个问题。

许可证

此包是开源软件,许可协议为 MIT 许可证

关于 Vdhicts

Vdhicts 是我的个人公司的名字,我在那里作为自由职业者工作。Vdhicts 为商业和教育机构开发并实施 IT 解决方案。