2017 © Pedro Peláez
 

library airtable-api-php

PHP wrapper for Airtable API

image

davidzadrazil/airtable-api-php

PHP wrapper for Airtable API

  • Thursday, November 23, 2017
  • by davidzadrazil
  • Repository
  • 1 Watchers
  • 2 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 23 % Grown

The README.md

Airtable API Wrapper

PHP wrapper for Airtable API., (*1)

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., (*2)

Important, (*3)

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., (*4)

Instalation

The best way to install davidzadrazil/airtable-api-php is using Composer:, (*5)

$ composer require davidzadrazil/airtable-api-php

Usage

Initialize

First of all, you must initialize Airtable class and Request handler:, (*6)

$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., (*7)

$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., (*8)

Filtration & Other parameters

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

$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., (*10)

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

Deleting records

Delete specific record with given record ID., (*11)

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

The Versions

23/11 2017

dev-master

9999999-dev

PHP wrapper for Airtable API

  Sources   Download

MIT

The Requires

 

by David Zadražil

23/11 2017

0.0.3

0.0.3.0

PHP wrapper for Airtable API

  Sources   Download

MIT

The Requires

 

by David Zadražil

23/11 2017

0.0.2

0.0.2.0

PHP wrapper for Airtable API

  Sources   Download

MIT

The Requires

 

by David Zadražil

23/11 2017

0.0.1

0.0.1.0

PHP wrapper for Airtable API

  Sources   Download

MIT

The Requires

 

by David Zadražil