fond-of / php-airtable-sdk
此包已被弃用,不再维护。未建议替代包。
Airtable API 的客户端库
1.0.0-beta.2
2020-05-18 11:06 UTC
Requires
- php: >=7.3
- ext-json: *
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- codeception/codeception: ^4.1
- php-coveralls/php-coveralls: ^2.2
- phpmd/phpmd: ^2.8
- phpro/grumphp-shim: ^0.18
- phpstan/phpstan: ^0.12
- roave/security-advisories: dev-master as 1.0.0
- sebastian/phpcpd: ^5.0
- sllh/composer-versions-check: ^2.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2022-05-25 14:11:13 UTC
README
此存储库已停止使用,没有替代品。
PHP 的 Airtable SDK 允许您通过 API 读取和写入 Airtable 的数据。库包含单个依赖项,即 Guzzle 6.x。
安装
SDK 可以通过 composer 安装
composer require fond-of/php-airtable-sdk
用法
<?php require __DIR__ . '/vendor/autoload.php'; use FondOf\Airtable\{Table, Airtable}; $base = 'baseId'; $table = 'tableId'; $client = (new Airtable([ 'apiKey' => '1234567' ]))->createApiClient(); $table = new Table($client, $base, $table);
读取单个记录
$record = $table->getRecord($recordId);
读取多个记录
$records = $table->getRecords();
写入记录
$fields = [ 'Name' => 'Foobar', 'Notes' => 'This is an example', 'Attachments' => [ [ 'url' => 'https://foobar.jpg', 'filename' => 'Example' ], ] ]; $table->writeRecord($fields);
增加记录限制(默认为 10)
$records = $table->limit(50)->getRecords();
最大限制为 100
更改表或基础
您不需要创建新表即可访问其他表或基础。有两种更改选项:一种是通过设置函数,另一种是通过流畅 API。
$records = $table->base('baseId')->table('tableId')->getRecords(); $table = $table->setBase('baseId'); $table = $table->setTable('tableId'); $records = $table->getRecords();
贡献
请随意提交问题和拉取请求。
要运行测试和代码清理器,您可以运行以下命令:
make grumphp
如果您只想运行测试,请使用以下命令:
make codeception
许可
请参阅许可文件以获取更多信息。