4leads/php-ninox-api

HTTP REST客户端,针对PHP简化设计

v1.0.2 2021-02-08 10:11 UTC

This package is auto-updated.

Last update: 2024-09-08 17:55:47 UTC


README

MIT licensed

PHP Ninox REST-API 客户端/包装器

这个库允许您使用PHP快速轻松地在Ninox后端执行REST操作。

安装

先决条件

  • PHP版本 ^7.4
  • Ninox账户,包括API功能

Ninox API文档

Ninox-API

安装包

将Ninox-API添加到您的composer.json文件中。如果您不使用Composer,我们强烈推荐它。它是管理PHP应用程序依赖项的绝佳方式。

composer require 4leads/php-ninox-api

使用方法

设置team_id和/或database_id为静态或动态

use Ninox\Ninox;

$client = new Ninox("API_KEY");
//either set team_id and/or databse globally
Ninox::setFixTeam("teamId");
Ninox::setFixDatabase("databseId");
$client->listTables();
//or set it on every request (overwrites global settings for this request if set)
$client->listTables("databseId2","teamId2");
//or just override database id but use global teamId
$client->listTables("databseId3");

在私有云/本地系统上

use Ninox\Ninox;
$client = new Ninox("API_KEY",["host" => "yourprivate.host.com"]);
//or
$client = new Ninox("API_KEY",["host" => "yourprivate.host.com/TEAMID/api/v1"]);
//or
$client = new Ninox("API_KEY",["host" => "yourprivate.host.com"], "TEAMID");

在私有云/本地端点上,调用listTeams不可用。建议在构造时设置teamid,这将作为全局设置使用。

文件上传/下载

该库使用裸露的curl函数进行文件上传/下载。这可能会导致大文件出现问题。请考虑大文件上的脚本运行时间和curl超时。