Simple Client for Airtable API

Overview

Airtable Client Bundle (Work In Progress)

Static code analysis Testing

The Airtable Client bundle is a Symfony bundle that attempts to make the Airtable API easier to use.

  • Retrieve data from a table, optionally choosing a view
  • Retrieve a recording by ID

Installation

Airtable Client Bundle requires PHP 7.4+ and Symfony 5.2+.

Install this bundle using Composer and Symfony Flex:

composer require yoanbernabeu/airtable-client-bundle

To configure Airtable Client Bundle, please create an airtable_client.yaml file in config/packages/ with the following information:

airtable_client:
  key:
  id:

To find your Airtable base ID, go to your API documentation and look in the Introduction section.

Airtable ID

To find your Airtable API key, go to your Account options and search in the API section.

Airtable KEY

Usage

use Yoanbernabeu\AirtableClientBundle\AirtableClientInterface;

class Foo
{
    public int $id;
    public string $bar;
}

class FooController
{
    public function bar(AirtableClientInterface $airtableClient)
    {
        $records = $airtableClient->findAll('tableName', 'viewName', Foo::class);
        
        foreach($records as $record) {
            /** @var Foo $foo */
            $foo = $record->getFields();
            
            echo $foo->bar;
        }
        
        $airtableClient->findBy('tableName', 'fieldName', 'value', Foo::class);      
          
        $record = $airtableClient->findOneById('tableName', 'id');
        
        /** @var Foo $foo */
        $foo = $record->getFields();
            
        echo $foo->bar;
        
        $airtableClient->findTheLatest('tableName', 'fieldName');

        $airtableClient->addOneRecord(
            'tableName',
            [
                'id' => 1,
                'bar' => 'lorem ipsum',
                ClassTest::class
            ]
        );
    }

    // ...
}

License

See the bundled LICENSE file.

Comments
  • [Http Client] Deal With Scopped client to separate repository and Http Client

    [Http Client] Deal With Scopped client to separate repository and Http Client

    This PR should fix #14

    Description

    • Separate Http Client and Repository

    • Configure Http Client with Symfony ScopingHttp Client to not pass base uri, ID, token and accept header

    • Test bundle configuration

    • Test HttpClient

    • Refacto tests

    • [x] Add scopped client

    • [x] Move methods to specific repository

    • [x] Fixe tests

    • [x] Add tests of new configuration

    opened by ismail1432 19
  • [refactor] โ˜• Short and simple method names

    [refactor] โ˜• Short and simple method names

    [refactor] โ˜• Short and simple method names

    ๐Ÿฌ 1. Renamed findTheLatest() to findLast()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 72)
    • ๐Ÿ“‚ src/AirtableClient (line 80)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 48)
    • โœ… tests/AirtableClientTest (lines 211-248)

    ๐Ÿฉ 2. Renamed addOneRecord() to add()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 74)
    • ๐Ÿ“‚ src/AirtableClient (line 113)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 57)
    • โœ… tests/AirtableClientTest (lines 312-363)

    ๐Ÿฐ 3. Renamed findOneById() to find()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 65)
    • ๐Ÿ“‚ src/AirtableClient (line 65)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 39)
    • โœ… tests/AirtableClientTest (lines 267-293)
    opened by TangoMan75 5
  • About branch naming

    About branch naming

    Hi,

    I noted this repository has only one branch named main. As the project evolves, at some point you will undoubtedly need to manage versions. What about starting with a branch 1.0 and push tags when the bundle is stable? Next versions will be merge in this branch (bug fixes), a branch 1.x (e.g. new features) and a branch 2.x for major changes. WDYT?

    opened by Spomky 5
  • [HttpClient] Deal with ScopedClient

    [HttpClient] Deal with ScopedClient

    At the moment we have to pass the base uri api.airtable.com/v0/ and the key and I think we can configure the HTTP client to already have these value see https://symfony.com/doc/current/http_client.html#scoping-client

    opened by ismail1432 4
  • Add smoke test, in order to check bundle integration

    Add smoke test, in order to check bundle integration

    • Delete some dead code
    • Rename Mock folder to Dummy
    • Rename Functionnal to Functional
    • Move tests in Functional to Unit folder
    • Install symfony/phpunit-bridge
    • Implement a smoke test AirtableClientTest, in order to check the good integration in Symfony
    • Implement AirtableClientInterface to respect Dependency Inversion Principle
    • Add some declare(strict_types=1);
    • Make services public in order to test its in smoke test
    • Refactor AirtableClient by adding return type to all methods present in AirtableClientInterface
    • Update README.md
    • Add more assertions in AirtableClientTest
    • Add test if the method findTheLatest return null
    • Code coverage at 100%
    • Add test in continuous integration by adding a github action
    Draft 
    opened by TBoileau 4
  • PHP-CS-FIXER and PHPStan

    PHP-CS-FIXER and PHPStan

    This PR contains opiniated configurations for php-cs-fixer and phpstan. The current configuration for php-cs-fixer is limited to PSR2 rules. This PR adds a configuration file for php-cs-fixer and adds several rules you may disagree with (just ask if so!). In addition, this PR also adds a configuration file for PHPStan. Reached level is 8, which is the maximum at the time of writting.

    Fixes #7 and introduces a new badge

    opened by Spomky 3
  • Toughts on grammar and semantics

    Toughts on grammar and semantics

    Hi Yoan, ๐Ÿ‘‹

    I was looking at your videos ๐Ÿ‘ and I thought I could help on your Airtable project with a couple suggestions.

    ๐Ÿ’ก 1. Rename findTheLatest() to findLast()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 72)
    • ๐Ÿ“‚ src/AirtableClient (line 80)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 48)
    • โœ… tests/AirtableClientTest lines(211-248)

    Though not grammatically incorrect per se, usage of superlative Latest and article The makes me cringe ๐Ÿ˜ฌ a little. I suppose native english speaker would simply use findLast(). For example if we would need to retrieve the first item in Airtable we would not name the method findTheFirst() we would simply name it findFirst() IMHO.

    ๐Ÿ’ก 2. Rename addOneRecord() to addRecord(), or add()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 74)
    • ๐Ÿ“‚ src/AirtableClient (line 113)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 57)
    • โœ… tests/AirtableClientTest lines(312-363)

    Do you plan to develop a addMultipleRecords() method at some point in the future ? If not, maybe addRecord() would be just as good from a semantics point of view then... Or just add(). I like to keep method names short and simple.

    ๐Ÿ’ก 3. Rename findOneById() to find()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 65)
    • ๐Ÿ“‚ src/AirtableClient (line 65)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 39)
    • โœ… tests/AirtableClientTest lines(267-293)

    With Doctrine we would just use find() method to query an item by id from the database, I suggest to use the same convention.


    Tell me what you think about it, and I will work on a PR to fix this.

    Hope that helps, peace โœŒ

    opened by TangoMan75 2
  • Feature/create news records

    Feature/create news records

    • Added the ability to create a new record, passing an array of values.
    • Addition of the choice of HTTP method in the request.
    • (I need help writing the tests)
    enhancement help wanted 
    opened by yoanbernabeu 1
  • Community rules

    Community rules

    Thank you all for your first contributions, it's magic! In order to open the project to as many people as possible, while keeping a good mood, I suggest adding:

    • CODE_OF_CONDUCT.md
    • CONTRIBUTING.md

    (I added the files in the .gitattributes)

    Feel free to make additions and modifications.

    documentation 
    opened by yoanbernabeu 1
  • .gitattributes file added

    .gitattributes file added

    With this tiny file, listed files and folders are ignored when requiring the bundle using --prefer-dis. This means that the documentation, the tests and all other non-essential files are not cloned in production with the following benefits:

    • lightweight package,
    • potentially unsecured files/class used for tests are not available.

    See this nice blog post for additional explaination. As mentioned in this article, you can see what will really be coned in production by executing git archive -o my-branch.zip HEAD. The result is a 13.6ko here with that file and 322ko without it. It may be useless in regards to the size of the bundle, but has significant impact as projects growth and number of daily download increase.

    Side note: even if the LICENCE file is not essential, I usually keep it in production

    opened by Spomky 1
  • Improved bundle configuration

    Improved bundle configuration

    This PR changes the way the service is configured:

    • by setting parameters as required
    • by adding info
    • by using named parameters instead of argument injection

    The use of a Php configuration file also helps when using modern IDE

    opened by Spomky 1
  • FIX: Deprecated: Optional parameter $dataClass declared

    FIX: Deprecated: Optional parameter $dataClass declared

    Deprecated: Optional parameter $dataClass declared before required parameter $recordData is implicitly treated as a required parameter.

    It's a private function, it is never called without parameter so just remove = null should be enough

    opened by Snowbaha 0
  • [Feature request] Upload files

    [Feature request] Upload files

    Offer the possibility of uploading a file (when editing, or when creating)

    Doc Airtable : To create new attachments in Docs Repo Flash Technique 2022, set the field value to an array of attachment objects. When creating an attachment, url is required, and filename is optional. Airtable will download the file at the given url and keep its own copy of it. All other attachment object properties will be generated server-side soon afterward.

    enhancement 
    opened by yoanbernabeu 0
Releases(0.1.5)
  • 0.1.5(Feb 2, 2022)

    What's Changed

    • Added Symfony 6 support by @yoanbernabeu in https://github.com/yoanbernabeu/Airtable-Client-Bundle/pull/30

    Full Changelog: https://github.com/yoanbernabeu/Airtable-Client-Bundle/compare/0.1.4...0.1.5

    Source code(tar.gz)
    Source code(zip)
  • 0.1.4(Dec 24, 2021)

    What's Changed

    • Add support for metadata api by @yoanbernabeu in https://github.com/yoanbernabeu/Airtable-Client-Bundle/pull/29

    Full Changelog: https://github.com/yoanbernabeu/Airtable-Client-Bundle/compare/0.1.3...0.1.4

    Source code(tar.gz)
    Source code(zip)
  • 0.1.3(Dec 10, 2021)

    What's Changed

    • feat : add pagination for findAll by @yoanbernabeu in https://github.com/yoanbernabeu/Airtable-Client-Bundle/pull/27

    Full Changelog: https://github.com/yoanbernabeu/Airtable-Client-Bundle/compare/0.1.2...0.1.3

    Source code(tar.gz)
    Source code(zip)
  • 0.1.2(Jul 30, 2021)

  • 0.1.1(Jun 27, 2021)

    [refactor] โ˜• Short and simple method names (by @TangoMan75)

    ๐Ÿฌ 1. Renamed findTheLatest() to findLast()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 72)
    • ๐Ÿ“‚ src/AirtableClient (line 80)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 48)
    • โœ… tests/AirtableClientTest (lines 211-248)

    ๐Ÿฉ 2. Renamed addOneRecord() to add()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 74)
    • ๐Ÿ“‚ src/AirtableClient (line 113)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 57)
    • โœ… tests/AirtableClientTest (lines 312-363)

    ๐Ÿฐ 3. Renamed findOneById() to find()

    ๐Ÿ”ฅ Affected files:

    • ๐Ÿ“ README (line 65)
    • ๐Ÿ“‚ src/AirtableClient (line 65)
    • ๐Ÿ“‚ src/AirtableClientInterface (line 39)
    • โœ… tests/AirtableClientTest (lines 267-293)
    Source code(tar.gz)
    Source code(zip)
  • 0.1.0(Jun 12, 2021)

    With the development of Airtable-Client-Bundle, we want to make it easy to use Airtable within a Symfony application.

    The development of the Bundle is underway, and it is possible that some commits cause significant changes in the use of the Bundle.

    If you wish to use the Bundle, we invite you to collaborate in the development of this first version, and to stabilize its use in a Symfony application.

    At the moment we offer the possibility of recovering data or sending new data. We want to add the possibility of modifying it and much more.

    Thanks everyone! Yoan

    And sorry for my bad English :)

    Source code(tar.gz)
    Source code(zip)
Owner
Yoan Bernabeu
Chef de Projets IT / DevOps at Alpes Isรจre Habitat | Freelance at YoanDev.co | YouTuber : https://www.youtube.com/c/yoandevco
Yoan Bernabeu
Chargebee API PHP Client (for API version 2 and Product Catalog version 2.0)

chargebee-php-sdk Overview This package provides an API client for Chargebee subscription management services. It connects to Chargebee REST APIs for

GLOBALIS media systems 8 Mar 8, 2022
Simple and effective multi-format Web API Server to host your PHP API as Pragmatic REST and / or RESTful API

Luracast Restler ![Gitter](https://badges.gitter.im/Join Chat.svg) Version 3.0 Release Candidate 5 Restler is a simple and effective multi-format Web

Luracast 1.4k Dec 14, 2022
The efficient and elegant, PSR-7 compliant JSON:API 1.1 client library for PHP

Woohoo Labs. Yang Woohoo Labs. Yang is a PHP framework which helps you to communicate with JSON:API servers more easily. Table of Contents Introductio

Woohoo Labs. 160 Oct 16, 2022
PHP unofficial client to CryptoPanic.com API

PHP unofficial client to CryptoPanic.com API CryptoPanic.com is a news aggregator platform indicating impact on price and market for traders and crypt

null 6 Nov 2, 2022
Laravel A2Reviews Client API lets you build apps, extensions, or plugins to get reviews from the A2reviews APP.

Overview Laravel A2Reviews Client API lets you build apps, extensions or plugins to get reviews from the A2reviews APP. Including adding reviews to a

Be Duc Tai 2 Sep 26, 2021
Tuya Api PHP Client

Tuya Api PHP Client This is a simple php client to interact with devices that support the tuya api over the cloud. Requirements I believe all is neede

null 11 Sep 22, 2022
This is the PHP ApiDQ API client

ApiDQ API PHP Client This is the PHP ApiDQ API client. This library allows using of the actual API version. You can find more info in the documentatio

Nikita Krasnikov 2 Oct 5, 2021
A basic, opinionated, Laravel Api Client

Laravel Api Client Installation Install the pacakage via composer composer require antonioprimera/laravel-api-client If you want to use pre-configured

Antonio Primera 2 Nov 3, 2022
Laravel Client REST Camunda API

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Uriel Reyes 1 Nov 5, 2021
Airbrake.io & Errbit integration for Symfony 3/4/5. This bundle plugs the Airbrake API client into Symfony project

AmiAirbrakeBundle Airbrake.io & Errbit integration for Symfony 3/4/5. This bundle plugs the Airbrake API client into Symfony project. Prerequisites Th

Anton Minin 8 May 6, 2022
This API provides functionality for creating and maintaining users to control a simple To-Do-List application. The following shows the API structure for users and tasks resources.

PHP API TO-DO-LIST v.2.0 This API aims to present a brief to consume a API resources, mainly for students in the early years of Computer Science cours

Edson M. de Souza 6 Oct 13, 2022
LaraBooks API - Simple API for iOS SwiftUI app tests.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Konrad Podrygalski 1 Nov 13, 2021
PHP Pi Horizon Client Library

phpi-sdk PHP Pi Horizon Client Library This is part of FASTLANE project for the pi payment gateway, as we are trying to build a pi wallet inside FASTL

EMSec 4 May 23, 2022
PSR-15 middleware to geolocate the client using the ip address

middlewares/geolocation ![SensioLabs Insight][ico-sensiolabs] Middleware to geolocate the client using the ip address and Geocoder and save the result

Middlewares 10 Mar 22, 2022
This API aims to present a brief to consume a API resources, mainly for students in the early years of Computer Science courses and the like.

Simple PHP API v.1.0 This API aims to present a brief to consume a API resources, mainly for students in the early years of Computer Science courses a

Edson M. de Souza 14 Nov 18, 2021
ๅพฎไฟกๆ”ฏไป˜ API v3 ็š„ PHP Library๏ผŒๅŒๆ—ถไนŸๆ”ฏๆŒ API v2

ๅพฎไฟกๆ”ฏไป˜ WeChatPay OpenAPI SDK [A]Sync Chainable WeChatPay v2&v3's OpenAPI SDK for PHP ๆฆ‚่งˆ ๅพฎไฟกๆ”ฏไป˜ APIv2&APIv3 ็š„Guzzle HttpClientๅฐ่ฃ…็ป„ๅˆ๏ผŒ APIv2ๅทฒๅ†…็ฝฎ่ฏทๆฑ‚ๆ•ฐๆฎ็ญพๅๅŠXML่ฝฌๆขๅ™จ๏ผŒๅบ”

null 275 Jan 5, 2023
API documentation API SCB EASY APP

SCB-API-EASY V3.0 API documentation SIAM COMMERCIAL BANK PUBLIC COMPANY LTD. API SCB Easy V3 endpoint = https://fasteasy.scbeasy.link 1.0. Get balance

SCB API Esay team 2 Sep 28, 2021
Courier API adalah project API untuk mengetahui ongkos kirim Logistik-logistik pengiriman barang antar kota & International

Courier API Courier API adalah project API untuk mengetahui ongkos kirim Logistik-logistik pengiriman barang antar kota (dalam negeri) & International

Rangga Darmajati 2 Sep 24, 2021
Laravel api tool kit is a set of tools that will help you to build a fast and well-organized API using laravel best practices.

Laravel API tool kit and best API practices Laravel api tool kit is a set of tools that will help you to build a fast and well-organized API using lar

Ahmed Esa 106 Nov 22, 2022