PHPackages                             square/connect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. square/connect

AbandonedArchivedLibrary[API Development](/categories/api)

square/connect
==============

This Package is deprecated, it is replaced by https://packagist.org/packages/square/square.

3.20200528.1(5y ago)1161.3M↓28.6%51[6 PRs](https://github.com/square/connect-php-sdk/pulls)7Apache-2.0PHPPHP &gt;=5.3.3

Since Mar 30Pushed 5y ago39 watchersCompare

[ Source](https://github.com/square/connect-php-sdk)[ Packagist](https://packagist.org/packages/square/connect)[ Docs](https://github.com/square/connect-php-sdk)[ RSS](/packages/square-connect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (111)Used By (7)

Square Connect PHP SDK - RETIRED replaced by [square/square-php-sdk](https://github.com/square/square-php-sdk)
==============================================================================================================

[](#square-connect-php-sdk---retired-replaced-by-squaresquare-php-sdk)

---

[![Build Status](https://camo.githubusercontent.com/f08aa7b236272890a9cd6abd8b0d872b9ec4927b41ccc260ca501f6814b40d82/68747470733a2f2f7472617669732d63692e6f72672f7371756172652f636f6e6e6563742d7068702d73646b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/square/connect-php-sdk)[![PHP version](https://camo.githubusercontent.com/0d1254ae69bb1799061e2789a14526b250b02e09a1a7479b274709d473f30535/68747470733a2f2f62616467652e667572792e696f2f70682f737175617265253246636f6e6e6563742e737667)](https://badge.fury.io/ph/square%2Fconnect)[![Apache-2 license](https://camo.githubusercontent.com/007ed3b9fd2ad6f7741034798e7e66a2c1f763ad9fbcc3a46435621c041c691c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d417061636865322d627269676874677265656e2e737667)](https://www.apache.org/licenses/LICENSE-2.0)
============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

NOTICE: Square Connect PHP SDK retired
--------------------------------------

[](#notice-square-connect-php-sdk-retired)

The Square Connect PHP SDK is retired (EOL) as of 2020-06-10 and will no longer receive bug fixes or product updates. To continue receiving API and SDK improvements, please follow the instructions below to migrate to the new [Square PHP SDK](https://github.com/square/square-php-sdk).

The old Connect SDK documentation is available under the [`/docs` folder](./docs/README.md).

---

- [Migrate to the Square PHP SDK](#migrate-to-the-square-php-sdk)
    - [Update your code](#update-your-code)
- [Example code migration](#example-code-migration)
- [Ask the Community](#ask-the-community)

---

Migrate to the Square PHP SDK
-----------------------------

[](#migrate-to-the-square-php-sdk)

Follow the instructions below to migrate your apps from the deprecated `square/connect` sdk to the new library.

You need to update your app to use the Square PHP SDK instead of the Connect PHP SDK The Square PHP SDK uses the `square/square` identifier.

1. On the command line, run:

```
$ php composer.phar require square/square

```

*-or-*

2. Update your composer.json:

```
"require": {
    ...
    "square/square": "^5.0.0",
    ...
}

```

### Update your code

[](#update-your-code)

1. Change all instances of `use SquareConnect\...` to `use Square\...`.
2. Replace `SquareConnect` models with the new `Square` equivalents
3. Update client instantiation to follow the method outlined below.
4. Update code for accessing response data to follow the method outlined below.
5. Check `$apiResponse->isSuccess()` or `$apiResponse->isError()` to determine if the call was a success.

To simplify your code, we also recommend that you use method chaining to access APIs instead of explicitly instantiating multiple clients.

#### Client instantiation

[](#client-instantiation)

Connect SDK

```
require 'vendor/autoload.php';

use SquareConnect\Configuration;
use SquareConnect\ApiClient;

$access_token = 'YOUR_ACCESS_TOKEN';
# setup authorization
$api_config = new Configuration();
$api_config->setHost("https://connect.squareup.com");
$api_config->setAccessToken($access_token);
$api_client = new ApiClient($api_config);
```

Square SDK

```
require 'vendor/autoload.php';

use Square\SquareClient;
use Square\Environment;

// Initialize the Square client.
$api_client = new SquareClient([
  'accessToken' => "YOUR_ACCESS_TOKEN",
  'environment' => Environment::SANDBOX
]); // In production, the environment arg is 'production'
```

Example code migration
----------------------

[](#example-code-migration)

As a specific example, consider the following code for creating a new payment from the following nonce:

```
# Fail if the card form didn't send a value for `nonce` to the server
$nonce = $_POST['nonce'];
if (is_null($nonce)) {
  echo "Invalid card data";
  http_response_code(422);
  return;
}
```

With the deprecated `square/connect` library, this is how you instantiate a client for the Payments API, format the request, and call the endpoint:

```
use SquareConnect\Api\PaymentsApi;
use SquareConnect\ApiException;

$payments_api = new PaymentsApi($api_client);
$request_body = array (
  "source_id" => $nonce,
  "amount_money" => array (
    "amount" => 100,
    "currency" => "USD"
  ),
  "idempotency_key" => uniqid()
);
try {
  $result = $payments_api->createPayment($request_body);
  echo "";
  print_r($result);
  echo "";
} catch (ApiException $e) {
  echo "Caught exception!";
  print_r("Response body:");
  echo ""; var_dump($e->getResponseBody()); echo "";
  echo "Response headers:";
  echo ""; var_dump($e->getResponseHeaders()); echo "";
}
```

Now consider equivalent code using the new `square/square` library:

```
require 'vendor/autoload.php';

use Square\Environment;
use Square\Exceptions\ApiException;
use Square\SquareClient;
use Square\Models\CreatePaymentRequest;
use Square\Models\Money;

$payments_api = $api_client->getPaymentsApi();

$money = new Money();
$money->setAmount(100);
$money->setCurrency('USD');
$create_payment_request = new CreatePaymentRequest($nonce, uniqid(), $money);
try {
  $response = $payments_api->createPayment($create_payment_request);
  if ($response->isError()) {
    echo 'Api response has Errors';
    $errors = $response->getErrors();
    exit();
  }
  echo '';
  print_r($response);
  echo '';
} catch (ApiException $e) {
  echo 'Caught exception!';
  exit();
}
```

That's it!

---

Ask the community
-----------------

[](#ask-the-community)

Please join us in our [Square developer community](https://squ.re/slack) if you have any questions!

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity56

Moderate usage in the ecosystem

Community41

Growing community involvement

Maturity75

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~12 days

Total

52

Last Release

2168d ago

Major Versions

2.20200122.2 → 3.20200226.02020-02-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb2855e537ca0333febcfae98e9a7fc6d9415a06e4505d3f49811577c078d815?d=identicon)[square-developers](/maintainers/square-developers)

![](https://www.gravatar.com/avatar/2e2c3a9a9576e1117216f11c52e51e97155b95706c1834061ea6e96e9c7f4f08?d=identicon)[jessiedlcs](/maintainers/jessiedlcs)

![](https://www.gravatar.com/avatar/e5b80bcd302b9c14f9dbc477b740d0e76fd921200e0b5a40b8af09b3c3ccc9c3?d=identicon)[lindy0820](/maintainers/lindy0820)

![](https://www.gravatar.com/avatar/57ef167d300d6819a089f1f5e495c2233cd893f644faf367145c7526d60eaad8?d=identicon)[xsquared](/maintainers/xsquared)

![](https://www.gravatar.com/avatar/2063239eb488bc2e3e460e4820d80a9f80670c5c010130939fb7d095de0f3e4f?d=identicon)[jffsquare](/maintainers/jffsquare)

---

Top Contributors

[![jessdelacruzsantos](https://avatars.githubusercontent.com/u/32309499?v=4)](https://github.com/jessdelacruzsantos "jessdelacruzsantos (31 commits)")[![ssung88](https://avatars.githubusercontent.com/u/20245766?v=4)](https://github.com/ssung88 "ssung88 (27 commits)")[![square-sdk-deployer](https://avatars.githubusercontent.com/u/33105396?v=4)](https://github.com/square-sdk-deployer "square-sdk-deployer (24 commits)")[![bunnyc1986](https://avatars.githubusercontent.com/u/1644274?v=4)](https://github.com/bunnyc1986 "bunnyc1986 (10 commits)")[![yonpols](https://avatars.githubusercontent.com/u/846795?v=4)](https://github.com/yonpols "yonpols (8 commits)")[![tristansokol](https://avatars.githubusercontent.com/u/867661?v=4)](https://github.com/tristansokol "tristansokol (8 commits)")[![DanGe42](https://avatars.githubusercontent.com/u/415786?v=4)](https://github.com/DanGe42 "DanGe42 (7 commits)")[![gkchestertron](https://avatars.githubusercontent.com/u/5278129?v=4)](https://github.com/gkchestertron "gkchestertron (4 commits)")[![vzhu](https://avatars.githubusercontent.com/u/1100878?v=4)](https://github.com/vzhu "vzhu (3 commits)")[![lindzeng](https://avatars.githubusercontent.com/u/13282989?v=4)](https://github.com/lindzeng "lindzeng (3 commits)")[![mikekono](https://avatars.githubusercontent.com/u/2348732?v=4)](https://github.com/mikekono "mikekono (3 commits)")[![frojasg](https://avatars.githubusercontent.com/u/314643?v=4)](https://github.com/frojasg "frojasg (2 commits)")[![wpappdev](https://avatars.githubusercontent.com/u/5280921?v=4)](https://github.com/wpappdev "wpappdev (2 commits)")[![deanpapastrat](https://avatars.githubusercontent.com/u/4662240?v=4)](https://github.com/deanpapastrat "deanpapastrat (2 commits)")[![jlabanca](https://avatars.githubusercontent.com/u/2755788?v=4)](https://github.com/jlabanca "jlabanca (1 commits)")[![cszhu](https://avatars.githubusercontent.com/u/8116601?v=4)](https://github.com/cszhu "cszhu (1 commits)")[![goblinhorde](https://avatars.githubusercontent.com/u/25335960?v=4)](https://github.com/goblinhorde "goblinhorde (1 commits)")[![hukid](https://avatars.githubusercontent.com/u/10461017?v=4)](https://github.com/hukid "hukid (1 commits)")[![alecholmes](https://avatars.githubusercontent.com/u/179268?v=4)](https://github.com/alecholmes "alecholmes (1 commits)")[![sseaman](https://avatars.githubusercontent.com/u/22420863?v=4)](https://github.com/sseaman "sseaman (1 commits)")

---

Tags

sdkphpapisdkswagger

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/square-connect/health.svg)

```
[![Health](https://phpackages.com/badges/square-connect/health.svg)](https://phpackages.com/packages/square-connect)
```

###  Alternatives

[dwolla/dwollaswagger

16438.9k](/packages/dwolla-dwollaswagger)[clever/clever-php

231.6k](/packages/clever-clever-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
