1
- ![ Square logo]
2
-
3
- # Square Connect PHP SDK - RETIRED
1
+ # Square Connect PHP SDK - RETIRED replaced by [ square/square-php-sdk] ( https://github.com/square/square-php-sdk )
4
2
5
3
---
6
4
@@ -38,7 +36,6 @@ The old Connect SDK documentation is available under the
38
36
Follow the instructions below to migrate your apps from the deprecated
39
37
` square/connect ` sdk to the new library.
40
38
41
- ### Option 1: With composer.json
42
39
You need to update your app to use the Square PHP SDK instead of the Connect PHP SDK
43
40
The Square PHP SDK uses the ` square/square ` identifier.
44
41
@@ -52,24 +49,10 @@ $ php composer.phar require square/square
52
49
```
53
50
"require": {
54
51
...
55
- "square/square": "* ",
52
+ "square/square": "^5.0.0 ",
56
53
...
57
54
}
58
55
```
59
-
60
- ### Option 2: From GitHub
61
- Clone the Square PHP SDK repository or download the zip into your project folder and
62
- then update the following line in your code from
63
-
64
- ``` php
65
- require('connect-php-sdk/autoload.php');
66
- ```
67
- to:
68
-
69
- ``` php
70
- require('square-php-sdk/autoload.php');
71
- ```
72
-
73
56
### Update your code
74
57
75
58
1 . Change all instances of ` use SquareConnect\... ` to ` use Square\... ` .
@@ -103,14 +86,13 @@ Square SDK
103
86
``` php
104
87
require 'vendor/autoload.php';
105
88
106
- use Square\Client;
107
-
108
- $access_token = 'YOUR_ACCESS_TOKEN';
89
+ use Square\SquareClient;
90
+ use Square\Environment;
109
91
110
92
// Initialize the Square client.
111
93
$api_client = new SquareClient([
112
- 'accessToken' => $access_token ,
113
- 'environment' => 'sandbox'
94
+ 'accessToken' => "YOUR_ACCESS_TOKEN" ,
95
+ 'environment' => Environment::SANDBOX
114
96
]); // In production, the environment arg is 'production'
115
97
```
116
98
@@ -162,6 +144,14 @@ try {
162
144
Now consider equivalent code using the new ` square/square ` library:
163
145
164
146
``` php
147
+ require 'vendor/autoload.php';
148
+
149
+ use Square\Environment;
150
+ use Square\Exceptions\ApiException;
151
+ use Square\SquareClient;
152
+ use Square\Models\CreatePaymentRequest;
153
+ use Square\Models\Money;
154
+
165
155
$payments_api = $api_client->getPaymentsApi();
166
156
167
157
$money = new Money();
@@ -200,6 +190,5 @@ Please join us in our [Square developer community] if you have any questions!
200
190
201
191
202
192
[ // ] : # " Link anchor definitions "
203
- [ Square Logo ] : https://docs.connect.squareup.com/images/github/github-square-logo.svg
204
193
[ Square PHP SDK ] : https://github.com/square/square-php-sdk
205
194
[ Square developer community ] : https://squ.re/slack
0 commit comments