You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connection.md
+43-2Lines changed: 43 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,55 @@ permalink: /connection.html
4
4
5
5
## Connection/Client() usage example
6
6
7
-
```php
7
+
There are two supported methods for credential handling in this SDK. The `ENV method`, and the `dependency injection method`. Both are shown below.
8
+
9
+
### The ENV Method (recommended)
10
+
11
+
Copy the file `.env.default` to `.env`, and update as needed.
12
+
13
+
In your code include the [Vlucas/phpdotenv](https://packagist.org/packages/vlucas/phpdotenv) package using `composer`, or another installation method provided by the package. (Composer recommended)
14
+
15
+
In your code you would use this package to load the contents of the `.env` file like so:
16
+
17
+
```php
8
18
require_once('vendor/autoload.php');
9
19
10
20
use Beachcasts\Airtable\AirtableClient;
11
21
use Beachcasts\Airtable\Config;
12
22
23
+
Dotenv\Dotenv::createImmutable(__DIR__)->load();
24
+
13
25
$airtableClient = new AirtableClient(Config::fromEnvironment(), <your_baseid>);
Then, you can continue using the `Table` object as desired for CRUD+L actions.
55
+
56
+
## Next Steps
57
+
58
+
After handling connection with the `AirtableClient`, you are ready to use the SDK to handle any CRUD+L actions. Please refer to the sidebar for navigation, as desired.
Copy file name to clipboardExpand all lines: docs/index.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,12 @@ permalink: /index.html
4
4
5
5
##Welcome to the Beachcasts Airtable SDK Documention
6
6
7
-
This documentation is a work-in-progress. But links to examples of each method usage can be found below:
7
+
The purpose of this project is to make using the Airtable API as simple as possible. Also, it enables PHP developers to use current conventions to interact with the REST style API at Airtable. This is done by including the GuzzleHttp package to abstract the cURL usage, and facilitate PSR-7 standards if your application uses it. However, you are not forced to comply with PSR-7 if so desired because it happens internally for the SDK.
8
8
9
+
This documentation is a work-in-progress. But the links will get you going quickly:
The first think you will need to do it create an [Airtable](https://airtable.com) account.
8
+
9
+
At the time of this writing, the Airtable API doesn't include functionality for creating a `Base`. Therefore, this SDK assumes you have already created a `Base` using the Airtable.com web-based gui.
10
+
11
+
Likewise, the Airtable API doesn't support the creation of a `Table` within the `Base`. Nor does it have functionality to create a `View` within a `Table`. So you will need to get your structure in place prior to using the API, or this SDK.
12
+
13
+
If Airtable adds this support to the API in the future, please let us know, so we can add it to the SDK.
14
+
15
+
## Installation
16
+
17
+
We recommend you install this SDK using [Composer](https://getcomposer.org). This allows dependencies to be easily loaded, and also enables PSR-4 style autoloading of the classes.
Using the terminal of your choice, issue the following command from within your application. (The command below assumes Linux OS.)
27
+
28
+
```bash
29
+
$ composer require beachcasts/airtable-sdk-php
30
+
```
31
+
32
+
### Configuration
33
+
34
+
After installation, there are some configuration choices to make. We recommend you store credentials in the `environment` by loading the `.env` file using something like [Vlucas/phpdotenv](https://packagist.org/packages/vlucas/phpdotenv). However, you can just as easily inject the credentials into the AirtableClient on instantiation.
35
+
36
+
## Next Steps
37
+
38
+
Please use any of the links in the sidebar, or continue to [Connection](connection.html).
0 commit comments