dexiio/dexi-api-client

PHP 5.3+ 的 Dexi API 客户端

1.2.1 2022-08-24 08:48 UTC

This package is auto-updated.

Last update: 2024-09-24 13:07:27 UTC


README

dexi.io

dexi-php-client

PHP 5.3+ 的 Dexi API 客户端

安装

dexi-php-client 可通过 composer/packagistdexi-api-client 的形式获取。通过将其添加到 composer.json 文件中安装它

"dexiio/dexi-api-client": "~1.1"

或者

composer require dexiio/dexi-api-client

示例

以下 示例 执行了一次运行并检索了执行信息

<?php

// Load using the composer autoloader to handle our PSR-4 namespacing
require __DIR__ . '/vendor/autoload.php';

define('CS_API_KEY', 'Your secret API Key'); // See https://app.dexi.io/#/api
define('CS_ACCOUNT_ID', 'Your account ID');
$someRunId = '59f3822f-6abc-4a01-81dc-5002a31f2dbc'; // Edit your runs inside the app to get their ID

\Dexi\Dexi::init(CS_API_KEY, CS_ACCOUNT_ID);

$newExecution = \Dexi\Dexi::runs()->execute($someRunId);

var_dump($newExecution);

文档

有关所有命名空间、方法和模型详情,请参阅 API 文档。全局 API 对象必须初始化后才能使用

\Dexi\Dexi::init(<你的 API 密钥>, <你的账户 ID>);

以下 API 命名空间包含在全局 Dexi\Dexi 类中

\Dexi\Dexi::executions() \Dexi\Dexi::runs() \Dexi\Dexi::robots() \Dexi\Dexi::dataSets()

这些命名空间包含 API 文档中显示的方法。模型定义在 \Dexi\DTO\ 命名空间中。

从 cloudscrape-client-php 迁移

GitHub: cloudscrape/cloudscrape-client-php 现在是 dexiio/dexi-php-client

Packagist: cloudscrape/cloudscrape-api-client 现在是 dexiio/dexi-api-client

如果您目前正在使用 cloudscrape-client-php,我们强烈建议您升级到此库,因为 cloudscrape-client-php 已被弃用,将不再开发,并且未来可能无法得到支持。大多数方法签名已更改,我们已添加 PSR-4 命名空间和对 Dexi 品牌的重新定位,以及转向支持 PHP7。还添加了新的类和方法。

测试

PHPUnit 集成测试提供在 test/Dexi 文件夹中。为了运行它们,必须在顶级文件夹中创建一个 configuration.ini 文件,并包含以下设置

[tests]
apiKey=<a valid api key>
accountId=<your account id>

# Optional fields
categoryId=<if set, will store created resources in this folder>
dataSetId=<if set, provides data set tests using this data set>

贡献

请通过 GitHub 提交错误报告、建议和拉取请求。

我们非常愿意审查任何拉取请求,并感谢您可能有的任何想法、评论或建议。

许可证

该库作为开源软件,在 MIT 许可证 的条款下提供。