PHP code example of zlt / airtable

1. Go to this page and download the library: Download zlt/airtable 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/ */

    

zlt / airtable example snippets


    $client = new Client('token');
    

   $client = new Client('token','custom-endpoint');
  

  $client->setAppId('appId');
  

  $client->setTable('tableId');
  

    $client->create([
        'field1' => 'value1',
        'field2' => 'value2',
    ]);
    

    $client->createMany([[
        'field1' => 'value1',
        'field2' => 'value2',
    ],[
        'field1' => 'value1',
        'field2' => 'value2',
    ]]);
    

  $client->get('recordId'); 
  

  $client->get(['recordId1','recordId2']); 
  

  $client->all();
  

  $client->update('recordId',[
      'field1' => 'value1',
      'field2' => 'value2',
  ]);
  

  $client->updateMany([
      'recordId1' => [
          'field1' => 'value1',
          'field2' => 'value2',
      ],
      'recordId2' => [
          'field1' => 'value1',
          'field2' => 'value2',
      ],
  ]);
  

  $client->delete('recordId');
  

  $client->deleteMany(['recordId1','recordId2']);
  

    $client->search()
            ->whereNot('Name', 'Doe')
            ->whereOr('Name', 'John')
            ->and(function ($search) {
                return $search->where('Status', 'Active');
            })
            ->get()