PHPackages                             treesapuk/laravel-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. [API Development](/categories/api)
4. /
5. treesapuk/laravel-square

ActiveLaravel-package[API Development](/categories/api)

treesapuk/laravel-square
========================

Square API integration with Laravel built on nikolag/core

v2.6.0(5y ago)025MITPHPPHP &gt;=7.0

Since Jul 10Pushed 4y agoCompare

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

READMEChangelogDependencies (12)Versions (23)Used By (0)

[![Test Coverage](https://camo.githubusercontent.com/d5c0c241d46eced0a979516ee695b2f49175c1702153aaa61d01f261c92dce00/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f37623663353330393663333533383134363363352f746573745f636f766572616765)](https://codeclimate.com/github/NikolaGavric94/laravel-square/test_coverage)[![Build Status](https://camo.githubusercontent.com/efc06e0319276e124ec46f17e0d459eca0bec3cf2486951dc127f79299b6ac90/68747470733a2f2f7472617669732d63692e6f72672f4e696b6f6c6147617672696339342f6c61726176656c2d7371756172652e737667)](https://travis-ci.org/NikolaGavric94/laravel-square)[![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. [Donation](#donating)
9. [License](#license)

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

[](#version-compatibility)

Library VersionLaravel VersionSquare 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)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 couple of environment variables

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

**Important:** `SQUARE_PAYMENT_IDENTIFIER` represents name of the column where we will keep unique ID that Square generates once it saves an Order. This means that you will need to add 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 enquiries 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-20Special thanks to all of the contributors!

Donating
--------

[](#donating)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://paypal.me/NikolaGavric/25)

Any amount helps to dedicate more time and resources for developing new stuff and keeping the library up-to-date with both `Laravel` and `Square` changes in the future. It will also help in creating future projects under the same brand.

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

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 97% 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 ~66 days

Recently: every ~111 days

Total

20

Last Release

1954d ago

Major Versions

v1.1.1 → v2.0.02018-04-07

PHP version history (5 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

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d0be68165c0a1a4659cd2c069de74a45fe2da452d05370b39456cabb6fd4223?d=identicon)[morganarnel](/maintainers/morganarnel)

---

Top Contributors

[![NikolaGavric94](https://avatars.githubusercontent.com/u/12602403?v=4)](https://github.com/NikolaGavric94 "NikolaGavric94 (255 commits)")[![morganarnel](https://avatars.githubusercontent.com/u/84181964?v=4)](https://github.com/morganarnel "morganarnel (4 commits)")[![Godlikehobbit](https://avatars.githubusercontent.com/u/12807847?v=4)](https://github.com/Godlikehobbit "Godlikehobbit (2 commits)")[![FR6](https://avatars.githubusercontent.com/u/286685?v=4)](https://github.com/FR6 "FR6 (1 commits)")[![PaulJulio](https://avatars.githubusercontent.com/u/594944?v=4)](https://github.com/PaulJulio "PaulJulio (1 commits)")

---

Tags

laravelpackagelibrarysquaresquare laravel integrationlaravel squaresquare-laravelnikolagnikolag square

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/treesapuk-laravel-square/health.svg)](https://phpackages.com/packages/treesapuk-laravel-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.0M531](/packages/laravel-passport)[aedart/athenaeum

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

255.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)
