Skip to content

Commit 0886adf

Browse files
committed
Cleaned up and added some needed steps to documenation. Also, attempting to create sidebar menu.
Signed-off-by: Adam Culp <adamculp@uws.net>
1 parent ad04bc4 commit 0886adf

10 files changed

Lines changed: 89 additions & 22 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Via Composer
2828
$ composer require beachcasts/airtable-sdk-php
2929
```
3030

31-
## Usage
31+
## Quick Start
3232

3333
Copy the file `.env.default` to `.env`, and update as needed.
3434

@@ -40,6 +40,8 @@ require_once('vendor/autoload.php');
4040
use Beachcasts\Airtable\AirtableClient;
4141
use Beachcasts\Airtable\Config;
4242

43+
// Add .env contents to your environment - see documentation for recomendations
44+
4345
$airtableClient = new AirtableClient(Config::fromEnvironment(), <your_baseid>);
4446
$table = $airtableClient->getTable(<your_table_name>);
4547
```

docs/connection.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,55 @@ permalink: /connection.html
44

55
## Connection/Client() usage example
66

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
818
require_once('vendor/autoload.php');
919

1020
use Beachcasts\Airtable\AirtableClient;
1121
use Beachcasts\Airtable\Config;
1222

23+
Dotenv\Dotenv::createImmutable(__DIR__)->load();
24+
1325
$airtableClient = new AirtableClient(Config::fromEnvironment(), <your_baseid>);
26+
1427
$table = $airtableClient->getTable(<your_table_name>);
1528
```
1629

17-
NOTE: Update `<your_baseid>` and `<your_table_name>` as needed.
30+
Then, you can continue using the `Table` object as desired for CRUD+L actions.
31+
32+
### The Dependency Injection Method
33+
34+
Using this method is done by calling a different method in the `Config`, as it is being instantiated. Example:
35+
36+
```php
37+
require_once('vendor/autoload.php');
38+
39+
use Beachcasts\Airtable\AirtableClient;
40+
use Beachcasts\Airtable\Config;
41+
42+
$airtableClient = new AirtableClient(
43+
Config::fromValues(
44+
string $baseUrl,
45+
string $version,
46+
string $apiKey
47+
),
48+
<your_baseid>
49+
);
50+
51+
$table = $airtableClient->getTable(<your_table_name>);
52+
```
53+
54+
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.

docs/create.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /create.html
55
## Create() method usage
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

docs/delete.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /delete.html
55
## Delete() method usage
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

docs/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ permalink: /index.html
44

55
##Welcome to the Beachcasts Airtable SDK Documention
66

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.
88

9+
This documentation is a work-in-progress. But the links will get you going quickly:
10+
11+
* [Getting Started](start.html)
12+
* [Client Connection](connection.html)
913
* [Create](create.html)
1014
* [Read](read.html)
1115
* [Update](update.html)

docs/list.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /list.html
55
## List() method usage
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

docs/read.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /read.html
55
## Read method usage
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

docs/replace.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /replace.html
55
## Replace usages
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

docs/start.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
permalink: /start.html
3+
---
4+
5+
## Getting Started
6+
7+
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.
18+
19+
### Prerequisites
20+
21+
* [Composer](https://getcomposer.org) installed globally
22+
* PHP v7.2+
23+
24+
### The Install
25+
26+
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).

docs/update.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ permalink: /update.html
55
## Update() method usage
66

77
```php
8-
<?php
9-
10-
// example usage file
118
require_once('../vendor/autoload.php');
129

1310
use Beachcasts\Airtable\AirtableClient;

0 commit comments

Comments
 (0)