Skip to content

Commit c703488

Browse files
committed
Revert master back to v3 API
1 parent 37a29f5 commit c703488

File tree

5 files changed

+603
-1731
lines changed

5 files changed

+603
-1731
lines changed

README.md

Lines changed: 2 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ The ConvertKit PHP SDK provides convinient access to the ConvertKit API from app
44

55
It includes a pre-defined set of methods for interacting with the API.
66

7-
## Version Guidance
7+
## Requirements
88

9-
| SDK Version | API Version | API Authentication | PHP Version |
10-
|-------------|-------------|--------------------|--------------|
11-
| 1.x | v3 | API Key and Secret | 7.4+ |
12-
| 2.x | v4 | OAuth | 8.0+ |
9+
PHP 7.4 and later.
1310

1411
## Composer
1512

@@ -37,85 +34,6 @@ If you use Composer, these dependencies should be handled automatically.
3734

3835
## Getting Started
3936

40-
### 2.x (v4 API, OAuth, PHP 8.0+)
41-
42-
Please reach out to ConvertKit to set up an OAuth application for you. We'll provide you with your Client ID and Secret.
43-
44-
```php
45-
// Require the autoloader (if you're using a PHP framework, this may already be done for you).
46-
require_once 'vendor/autoload.php';
47-
48-
// Initialize the API class.
49-
$api = new \ConvertKit_API\ConvertKit_API(
50-
clientID: '<your_oauth_client_id>',
51-
clientSecret: '<your_oauth_client_secret>'
52-
);
53-
```
54-
55-
To begin the OAuth process, redirect the user to ConvertKit to grant your application access to their ConvertKit account.
56-
57-
```php
58-
header('Location: '.$api->get_oauth_url('<your_redirect_uri>'));
59-
```
60-
61-
Once the user grants your application access to their ConvertKit account, they'll be redirected to your Redirect URI with an authorization code. For example:
62-
63-
`your-redirect-uri?code=<auth_code>`
64-
65-
At this point, your application needs to exchange the authorization code for an access token and refresh token.
66-
67-
```php
68-
$result = $api->get_access_token(
69-
authCode: '<auth_code>',
70-
redirectURI: '<your_redirect_uri>'
71-
);
72-
```
73-
74-
`$result` is an array comprising of:
75-
- `access_token`: The access token, used to make authenticated requests to the API
76-
- `refresh_token`: The refresh token, used to fetch a new access token once the current access token has expired
77-
- `created_at`: When the access token was created
78-
- `expires_in`: The number of seconds from `created_at` that the access token will expire
79-
80-
Once you have an access token, re-initialize the API class with it:
81-
82-
```php
83-
// Initialize the API class.
84-
$api = new \ConvertKit_API\ConvertKit_API(
85-
clientID: '<your_oauth_client_id>',
86-
clientSecret: '<your_oauth_client_secret>',
87-
accessToken: '<your_access_token>'
88-
);
89-
```
90-
91-
To refresh an access token:
92-
93-
```php
94-
$result = $api->refresh_token(
95-
refreshToken: '<your_refresh_token>',
96-
redirectURI: '<your_redirect_uri>'
97-
);
98-
```
99-
100-
`$result` is an array comprising of:
101-
- `access_token`: The access token, used to make authenticated requests to the API
102-
- `refresh_token`: The refresh token, used to fetch a new access token once the current access token has expired
103-
- `created_at`: When the access token was created
104-
- `expires_in`: The number of seconds from `created_at` that the access token will expire
105-
106-
Once you have refreshed the access token i.e. obtained a new access token, re-initialize the API class with it:
107-
108-
```php
109-
// Initialize the API class.
110-
$api = new \ConvertKit_API\ConvertKit_API(
111-
clientID: '<your_oauth_client_id>',
112-
clientSecret: '<your_oauth_client_secret>',
113-
accessToken: '<your_new_access_token>'
114-
);
115-
```
116-
117-
### 1.x (v3 API, API Key and Secret, PHP 7.4+)
118-
11937
Get your ConvertKit API Key and API Secret [here](https://app.convertkit.com/account/edit) and set it somewhere in your application.
12038

12139
```php

phpstan.neon.dist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ parameters:
66

77
# Should not need to edit anything below here
88
# Rule Level: https://phpstan.org/user-guide/rule-levels
9-
level: 8
9+
level: 8
10+
11+
# Ignore the following errors, as PHPStan either does not have registered symbols for them yet,
12+
# or the symbols are inaccurate.
13+
ignoreErrors:
14+
- '#\$headers of class GuzzleHttp\\Psr7\\Request constructor expects#'

phpstan.neon.example

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ parameters:
66

77
# Should not need to edit anything below here
88
# Rule Level: https://phpstan.org/user-guide/rule-levels
9-
level: 8
9+
level: 8
10+
11+
# Ignore the following errors, as PHPStan either does not have registered symbols for them yet,
12+
# or the symbols are inaccurate.
13+
ignoreErrors:
14+
- '#\$headers of class GuzzleHttp\\Psr7\\Request constructor expects#'

0 commit comments

Comments
 (0)