PHPackages                             nikolag/square - 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. nikolag/square

Abandoned → [https://github.com/NikolaGavric94/laravel-square/](/?search=https%3A%2F%2Fgithub.com%2FNikolaGavric94%2Flaravel-square%2F)Laravel-package

nikolag/square
==============

Square API integration with Laravel built on nikolag/core

v3.5.0(5mo ago)3883025[5 PRs](https://github.com/NikolaGavric94/laravel-square/pulls)MITPHPPHP &gt;=8.2CI passing

Since Jul 10Pushed 5mo ago4 watchersCompare

[ Source](https://github.com/NikolaGavric94/laravel-square)[ Packagist](https://packagist.org/packages/nikolag/square)[ RSS](/packages/nikolag-square/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (14)Versions (39)Used By (0)

[![Code Coverage](https://camo.githubusercontent.com/d07aa6a30427f5623edff44c14bf1c4103a6b8b1cb2643f3dd95b79b8548fafb/68747470733a2f2f716c74792e73682f67682f4e696b6f6c6147617672696339342f70726f6a656374732f6c61726176656c2d7371756172652f636f7665726167652e737667)](https://qlty.sh/gh/NikolaGavric94/projects/laravel-square)[![Maintainability](https://camo.githubusercontent.com/3d910feeb23facda7d7563f41d6817ea5e1151dc24f54c735ae9212431ceb52d/68747470733a2f2f716c74792e73682f67682f4e696b6f6c6147617672696339342f70726f6a656374732f6c61726176656c2d7371756172652f6d61696e7461696e6162696c6974792e737667)](https://qlty.sh/gh/NikolaGavric94/projects/laravel-square)[![Build and test PHP 8.x](https://github.com/NikolaGavric94/laravel-square/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/NikolaGavric94/laravel-square/actions/workflows/main.yml)[![Latest Stable Version](https://camo.githubusercontent.com/9869519341be54ecd9ba0d0ccc41bb38e0cb006cb99ce3e5c9f3a4c63c47b45e/68747470733a2f2f706f7365722e707567782e6f72672f6e696b6f6c61672f6c61726176656c2d7371756172652f762f737461626c65)](https://packagist.org/packages/nikolag/laravel-square)[![License](https://camo.githubusercontent.com/426a49b7ccdd72ecf95aae4cca6dab23245fc413d49cfb7ef882ac58d7db5471/68747470733a2f2f706f7365722e707567782e6f72672f6e696b6f6c61672f6c61726176656c2d7371756172652f6c6963656e7365)](https://packagist.org/packages/nikolag/laravel-square)

[ ![](https://camo.githubusercontent.com/a23e9fdaa0cde44cec50382dc9287c2e0ad8207c9acccd47938197c6865be498/68747470733a2f2f6d69726f2e6d656469756d2e636f6d2f6d61782f313932302f312a38345161554d5f58336876704f38716539625f356a772e706e67 "Nikolag Laravel Package")](https://medium.com/square-corner-blog/square-implementation-with-laravel-22a4ad3fe1ec)

---

Square integration with Laravel/Lumen &gt;=5.5 built on [nikolag/core](https://github.com/NikolaGavric94/nikolag-core/)

1. [Version Compatibility](#version-compatibility)
2. [Installation guide](#installation-guide)
3. [Customer System](#customers-system)
4. [Order System](#orders-system)
5. [Examples](#examples)
6. [Available methods](#all-traits-and-their-methods)
7. [Contributing](#contributing)
8. [License](#license)

Version Compatibility
---------------------

[](#version-compatibility)

### Old square connect api

[](#old-square-connect-api)

Library VersionLaravel VersionSquare Connect Version[2.3.x](https://github.com/NikolaGavric94/laravel-square/compare/v2.3.0...master) &gt;= 5.5[2.20190814 (Square Connect V1)](https://github.com/square/connect-php-sdk/tree/2.20190710.0)[2.4.x](https://github.com/NikolaGavric94/laravel-square/compare/v2.4.0...master) &gt;= 6.x[2.20190925.0 (Square Connect V2)](https://github.com/square/connect-php-sdk/tree/2.20190925.0)[2.5.x](https://github.com/NikolaGavric94/laravel-square/compare/v2.5.0...master) &gt;= 7.x[2.20190925.0 (Square Connect V2)](https://github.com/square/connect-php-sdk/tree/2.20190925.0)[2.6.x](https://github.com/NikolaGavric94/laravel-square/compare/v2.6.0...master) &gt;= 8.x[3.20200528.1 (Square Connect V2)](https://github.com/square/connect-php-sdk/tree/3.20200528.1)### New square sdk

[](#new-square-sdk)

Library VersionLaravel VersionSquare SDK Version[3.0.x](https://github.com/NikolaGavric94/laravel-square/compare/v2.6.0...v3.0.2) &gt;= 8.x[17.0.0.20211215](https://github.com/square/square-php-sdk/tree/17.0.0.20211215)[3.1.x](https://github.com/NikolaGavric94/laravel-square/compare/v3.0.2...v3.1.0) &gt;= 9.x[25.1.0.20230119](https://github.com/square/square-php-sdk/tree/25.1.0.20230119)[3.2.0](https://github.com/NikolaGavric94/laravel-square/compare/v3.2.0...3.2.1) &gt;= 10.x[25.1.0.20230119](https://github.com/square/square-php-sdk/tree/25.1.0.20230119)[3.2.x](https://github.com/NikolaGavric94/laravel-square/compare/v3.2.1...v3.2.) &gt;= 10.x[29.0.0.20230720](https://github.com/square/square-php-sdk/tree/29.0.0.20230720)[3.3.x](https://github.com/NikolaGavric94/laravel-square/compare/v3.2.1...v3.3.0) &gt;= 10.x[29.0.0.20230720](https://github.com/square/square-php-sdk/tree/29.0.0.20230720)[3.4.0](https://github.com/NikolaGavric94/laravel-square/compare/v3.3.0...v3.4.0) &gt;= 11.x[29.0.0.20230720](https://github.com/square/square-php-sdk/tree/29.0.0.20230720)[3.4.x](https://github.com/NikolaGavric94/laravel-square/compare/v3.4.0...master) &gt;= 11.x[40.0.0.20250123](https://github.com/square/square-php-sdk/tree/40.0.0.20250123)[3.5.x](https://github.com/NikolaGavric94/laravel-square/compare/v3.5.0...master) &gt;= 12.x[40.0.0.20250123](https://github.com/square/square-php-sdk/tree/40.0.0.20250123)**If you are updating from versions below 3.0 then you need to execute: `php artisan migrate`. This will add some columns required by the library into the tables created by the library, your own tables won't be affected.**

Installation guide
------------------

[](#installation-guide)

`composer require nikolag/laravel-square`

**Note:** Due to Laravel [Package Discovery](https://laravel.com/docs/5.6/packages#package-discovery), registering service providers and facades manually for this project as of Laravel 5.5 is deprecated and no longer required since the package is adapted to automatically register these stuff for you. But there are still couple of steps to do in order to use this package.

---

First you have to publish configuration files:

```
php artisan vendor:publish --tag=nikolag_config
```

Check configuration files out at `config/nikolag.php` before continuing.

**Important:** If for some reason you can't see `square` driver inside of `connections` array, you'll have to add it manually. You can find configuration file [here](https://github.com/NikolaGavric94/laravel-square/blob/master/src/config/nikolag.php) and copy everything from inside `connections` array and **append** to your `connections` array inside of published config file (`config/nikolag.php`)

 [![nikolag configuration](https://camo.githubusercontent.com/68bdc681b632ffead8e7a4464098b292360b917fc851525098e615565f74cb14/68747470733a2f2f692e6962622e636f2f767342435a744a2f53637265656e73686f742d323031392d31302d31342d61742d31302d35302d35322e706e67 "Nikolag Configuration File")](https://camo.githubusercontent.com/68bdc681b632ffead8e7a4464098b292360b917fc851525098e615565f74cb14/68747470733a2f2f692e6962622e636f2f767342435a744a2f53637265656e73686f742d323031392d31302d31342d61742d31302d35302d35322e706e67)
 *Figure 1. Config file*

After finishing with configuration files, you should run migrations with the following command

```
php artisan migrate
```

---

Then add your credentials for Square API inside of `.env` and also add fully qualified name (namespace) for your classes.

```
SQUARE_APPLICATION_ID=
SQUARE_TOKEN=
```

### Customers system

[](#customers-system)

To be able to utilize the customers system for Users, your User class must use `HasCustomers` trait.

```
...
use Nikolag\Square\Traits\HasCustomers;

class User extends Model {
  use HasCustomers;
  ...
}
```

You also need to define user namespace

```
// .env file
SQUARE_USER_NAMESPACE=
```

### Orders system

[](#orders-system)

To be able to utilize the order system for Users, your Order class must use `HasProducts` trait and define `$table` property.

```
...
use Nikolag\Square\Traits\HasProducts;

class Order extends Model {
  use HasProducts;
  ...

  /**
   * The table associated with the model.
   *
   * @var string
   */
  protected $table = '';
  ...
}
```

You also need to define a couple of environment variables

```
// .env file
SQUARE_ORDER_NAMESPACE=
SQUARE_ORDER_IDENTIFIER=
SQUARE_PAYMENT_IDENTIFIER=
```

**Important:** `SQUARE_PAYMENT_IDENTIFIER` represents the name of the column where we will keep the unique ID that Square generates once it saves an Order. This means that you will need to add a new column to your Orders table which will hold that value.

Examples
--------

[](#examples)

##### Simple examples

[](#simple-examples)

Simple examples are moved to [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/Simple%20Examples) pages to avoid unnecessary scrolling of `README.md`.

##### Examples with customers

[](#examples-with-customers)

Examples with customers are moved to [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/Customer%20Examples) pages to avoid unnecessary scrolling of `README.md`.

##### Examples with order

[](#examples-with-order)

Examples with orders are moved to the [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/Order%20Examples) pages to avoid unnecessary scrolling of `README.md`.

All traits and their methods
----------------------------

[](#all-traits-and-their-methods)

##### HasProducts

[](#hasproducts)

All methods for this trait are moved to the [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/HasProducts%20Trait) pages to avoid unnecessary scrolling of `README.md`.

##### HasCustomers

[](#hascustomers)

All methods for this trait are moved to the [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/HasCustomers%20Trait) pages to avoid unnecessary scrolling of `README.md`.

### All facades and their methods

[](#all-facades-and-their-methods)

##### Square

[](#square)

All methods for this facade are moved to the [wiki](https://github.com/NikolaGavric94/laravel-square/wiki/Square%20Facade) pages to avoid unnecessary scrolling of `README.md`.

Contributing
------------

[](#contributing)

Everyone is welcome to contribute to this repository, simply open up an issue and label the request, whether it is an issue, bug or a feature. For any other inquiries send an email to

### Contributors

[](#contributors)

NameChangesDate[@Godlikehobbit](https://github.com/Godlikehobbit)Add optional currency parameter to charge function [pull request #6](https://github.com/NikolaGavric94/laravel-square/pull/6)2017-09-12[@PaulJulio](https://github.com/PaulJulio)Cap square/connect version to resolve deprecation exceptions [pull request #27](https://github.com/NikolaGavric94/laravel-square/pull/27)2019-09-20[@Alex Oleynik](https://github.com/alexoleynik0)Fixes TypeError when updating customers [pull request #71](https://github.com/NikolaGavric94/laravel-square/pull/71)2022-06-28[@qooplmao](https://github.com/qooplmao)Adds support for 3DS/SCA [pull request #74](https://github.com/NikolaGavric94/laravel-square/pull/74)2023-01-13[@Mrkbingham](https://github.com/Mrkbingham)For his continous support over the years and helping tremendously in keeping this library afloat~Special thanks to all of the contributors!

License
-------

[](#license)

MIT License

Copyright (c) Nikola Gavrić

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance70

Regular maintenance activity

Popularity30

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 71.8% of commits — single point of failure

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 ~92 days

Recently: every ~65 days

Total

34

Last Release

171d ago

Major Versions

v1.1.1 → v2.0.02018-04-07

v2.6.0 → v3.0.12021-12-31

PHP version history (7 changes)v1.0.0PHP &gt;=5.6.4

v1.0.2PHP &gt;=7.0.0

v2.0.0PHP &gt;=7.1.3

v2.3.0PHP &gt;=7.1.0

v2.6.0PHP &gt;=7.0

3.1.x-devPHP &gt;=8.1

v3.3.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![NikolaGavric94](https://avatars.githubusercontent.com/u/12602403?v=4)](https://github.com/NikolaGavric94 "NikolaGavric94 (379 commits)")[![Mrkbingham](https://avatars.githubusercontent.com/u/4382816?v=4)](https://github.com/Mrkbingham "Mrkbingham (129 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (7 commits)")[![qooplmao](https://avatars.githubusercontent.com/u/2874965?v=4)](https://github.com/qooplmao "qooplmao (5 commits)")[![PharaohAsh](https://avatars.githubusercontent.com/u/1362940?v=4)](https://github.com/PharaohAsh "PharaohAsh (2 commits)")[![Godlikehobbit](https://avatars.githubusercontent.com/u/12807847?v=4)](https://github.com/Godlikehobbit "Godlikehobbit (2 commits)")[![PaulJulio](https://avatars.githubusercontent.com/u/594944?v=4)](https://github.com/PaulJulio "PaulJulio (1 commits)")[![FR6](https://avatars.githubusercontent.com/u/286685?v=4)](https://github.com/FR6 "FR6 (1 commits)")[![alexoleynik0](https://avatars.githubusercontent.com/u/47355025?v=4)](https://github.com/alexoleynik0 "alexoleynik0 (1 commits)")[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (1 commits)")

---

Tags

laravellaravel-5-packagelaravel-square-integrationnikolagpackagesquarelaravelpackagelibrarysquaresquare laravel integrationlaravel squaresquare-laravelnikolagnikolag square

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nikolag/laravel-square

Square API integration with Laravel built on nikolag/core

3827.3k](/packages/nikolag-laravel-square)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k43.5M5.2k](/packages/larastan-larastan)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)

PHPackages © 2026

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