1. Go to this page and download the library: Download zadorin/airtable-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$recordset = $client->table($tableName)
->select('id', 'name', 'email') // you can use shortcut select('*') to fetch all columns
->where(['name' => 'Ivan', 'email' => '[email protected]'])
->orderBy(['id' => 'desc'])
->limit(10)
->execute();
var_dump($recordset->fetchAll()); // returns set of Record objects
var_dump($recordset->asArray()); // returns array of arrays
// look for emails, matching @gmail.com in case-insensitive way
$query->where('email', 'match', '(?i)^(.+)@gmail.com$');
// look for emails, which ends with @gmail.com
$query->where('email', 'like', '%@gmail.com');
// look for names, which starts with Ivan
$query->where('name', 'like', 'Ivan%');
// look for urls, which contains substring (both variants below works the same):
$query->where('url', 'like', '%github%');
$query->where('url', 'like', 'github');
$query->whereDate('birthdate', new \DateTimeImmutable('2022-03-08'));
$query->whereDateTime('meeting_start', '2022-04-01 11:00:00');
$query
->whereDate('birthdate', '>=', new \DateTimeImmutable('2022-03-01'))
->andWhereDate('birthdate', '<', new \DateTimeImmutable('2022-04-01'));
$query->whereDateBetween('birthdate', '2022-03-01', '2022-03-31'); // left and right borders
$client
->table('users')
->insert(['name' => 'Ivan', 'contacts' => '[email protected]'])
->typecast(true) // true is default value and can be skipped
->execute();
$client = new \Zadorin\Airtable\Client($apiKey, $database);
$client->throttling(false);
try {
$inserted = $client->table($tableName)->insert()->execute();
} catch (RequestError $e) {
// catch Airtable responses here
var_dump($e->getMessage());
var_dump($e->getLastRequest()->getResponseInfo());
} catch (AirtableError $e) {
// catch package errors. In that case it will be "No records specified for insert"
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.