定制 digiti/airtable-api-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

digiti/airtable-api-php

最新稳定版本:0.0.5

Composer 安装命令:

composer require digiti/airtable-api-php

包简介

PHP wrapper for Airtable API

README 文档

README

PHP wrapper for Airtable API.

Getting started

Airtable API does not allow to manipulate with bases or with fields in tables. So you must create tables and its fields manually in Airtable interface.

Important

Every base has own documentation where you find base identificator (starts with app e.g. appGYr9gxkAk0wKNk), which is required parameter. API Key is located in account settings.

Instalation

The best way to install davidzadrazil/airtable-api-php is using Composer:

$ composer require davidzadrazil/airtable-api-php

Usage

Initialize

First of all, you must initialize Airtable class and Request handler:

$airtable = new DavidZadrazil\AirtableApi\Airtable('API_KEY', 'BASE_ID');
$request = new DavidZadrazil\AirtableApi\Request($airtable, 'TABLE_NAME');

Fetching records

Important: Airtable limits response with maximum 100 records.

$tableRequest = $request->getTable();
do {
  foreach ($tableRequest->getRecords() as $record) {
    echo $record->getName();
    echo $record->getEmail();
    echo $record->getAnotherValue();
  }
} while ($tableRequest = $tableRequest->nextPage());

getRecords() returns array of AirtableApi\Record.

Filtration & Other parameters

Fetching records from table can be used with available parameters like filterByFormula, maxRecords, pageSize, sort or view.

$request->getTable(['pageSize' => 50, 'filterByFormula' => '{Name} = "test"']);

Creating records

$response = $request->createRecord(
  [
    'Name' => 'This appears in Name field',
    'Email' => 'john@doe.com',
    'LinkToAnotherTable' => ['recsH5WYbYpwWMlvb']
  ]
);

$response->isSuccess(); // true / false
$response->getRecords(); // returns newly created record with ID

Updating records

Updates specific record with given record ID.

$response = $request->updateRecord('recsH5WYbYpwWMlvb', ['Name' => 'Updated value']);
$response->isSuccess(); // true / false

Deleting records

Delete specific record with given record ID.

$response = $request->deleteRecord('recsH5WYbYpwWMlvb');
$response->isSuccess(); // true / false

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 7
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-15