2017 © Pedro Peláez
 

laravel-package square

Square API integration with Laravel built on nikolag/core

image

nikolag/square

Square API integration with Laravel built on nikolag/core

  • Sunday, June 17, 2018
  • by NikolaGavric94
  • Repository
  • 3 Watchers
  • 3 Stars
  • 219 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 11 Versions
  • 7 % Grown

The README.md

Test Coverage Build and test PHP 8.x Latest Stable Version License, (*1)

, (*2)


Square integration with Laravel/Lumen >=5.5 built on nikolag/core, (*3)

  1. Version Compatibility
  2. Installation guide
  3. Customer System
  4. Order System
  5. Examples
  6. Available methods
  7. Contributing
  8. License

Version Compatibility

Old square connect api

Library Version Laravel Version Square Connect Version
2.3.x   >= 5.5 2.20190814 (Square Connect V1)
2.4.x   >= 6.x 2.20190925.0 (Square Connect V2)
2.5.x   >= 7.x 2.20190925.0 (Square Connect V2)
2.6.x   >= 8.x 3.20200528.1 (Square Connect V2)

New square sdk

Library Version Laravel Version Square SDK Version
3.0.x   >= 8.x 17.0.0.20211215
3.1.x   >= 9.x 25.1.0.20230119
3.2.0   >= 10.x 25.1.0.20230119
3.2.x   >= 10.x 29.0.0.20230720

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., (*4)

Installation guide

composer require nikolag/laravel-square, (*5)

Note: Due to Laravel 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., (*6)


First you have to publish configuration files:, (*7)

php artisan vendor:publish --tag=nikolag_config

Check configuration files out at config/nikolag.php before continuing., (*8)

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 and copy everything from inside connections array and append to your connections array inside of published config file (config/nikolag.php), (*9)

nikolag configuration
Figure 1. Config file , (*10)

After finishing with configuration files, you should run migrations with the following command, (*11)

php artisan migrate

Then add your credentials for Square API inside of .env and also add fully qualified name (namespace) for your classes. ```.env SQUARE_APPLICATION_ID= SQUARE_TOKEN=, (*12)


### Customers system To be able to utilize the customers system for Users, your User class must use `HasCustomers` trait. ```php ... use Nikolag\Square\Traits\HasCustomers; class User extends Model { use HasCustomers; ... }

You also need to define user namespace ```.env // .env file SQUARE_USER_NAMESPACE=, (*13)


### Orders system To be able to utilize the order system for Users, your Order class must use `HasProducts` trait and define `$table` property. ```php ... use Nikolag\Square\Traits\HasProducts; class Order extends Model { use HasProducts; ... /** * The table associated with the model. * * @var string */ protected $table = '<TABLE_NAME>'; ... }

You also need to define a couple of environment variables .env // .env file SQUARE_ORDER_NAMESPACE=<ORDER_NAMESPACE> SQUARE_ORDER_IDENTIFIER=<ORDER_IDENTIFIER> SQUARE_PAYMENT_IDENTIFIER=<ORDER_SQUARE_ID_COLUMN> 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., (*14)

Examples

Simple examples

Simple examples are moved to wiki pages to avoid unnecessary scrolling of README.md., (*15)

Examples with customers

Examples with customers are moved to wiki pages to avoid unnecessary scrolling of README.md., (*16)

Examples with order

Examples with orders are moved to the wiki pages to avoid unnecessary scrolling of README.md., (*17)

All traits and their methods

HasProducts

All methods for this trait are moved to the wiki pages to avoid unnecessary scrolling of README.md., (*18)

HasCustomers

All methods for this trait are moved to the wiki pages to avoid unnecessary scrolling of README.md., (*19)

All facades and their methods

Square

All methods for this facade are moved to the wiki pages to avoid unnecessary scrolling of README.md., (*20)

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 nikola.gavric94@gmail.com, (*21)

Contributors

Name Changes Date
@Godlikehobbit Add optional currency parameter to charge function pull request #6 2017-09-12
@PaulJulio Cap square/connect version to resolve deprecation exceptions pull request #27 2019-09-20
@Alex Oleynik Fixes TypeError when updating customers pull request #71 2022-06-28
@qooplmao Adds support for 3DS/SCA pull request #74 2023-01-13

Special thanks to all of the contributors!, (*22)

License

MIT License, (*23)

Copyright (c) Nikola Gavrić nikola.gavric94@gmail.com, (*24)

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:, (*25)

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

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., (*27)

The Versions

17/06 2018

dev-develop

dev-develop

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel library package square square laravel integration square-laravel nikolag nikolag-square

16/04 2018

dev-master

9999999-dev

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel library package square square laravel integration square-laravel

16/04 2018

v2.0.1

2.0.1.0

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel library package square square laravel integration square-laravel

07/04 2018

v2.0.0

2.0.0.0

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel library package square square laravel integration square-laravel

06/11 2017

v1.1.1

1.1.1.0

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration square-laravel

06/10 2017

v1.1.0

1.1.0.0

Square API integration with Laravel built on nikolag/core

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration square-laravel

26/09 2017

v1.0.4

1.0.4.0

Square API integration with Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration square-laravel

26/09 2017

v1.0.3

1.0.3.0

Square API integration with Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration

12/09 2017

v1.0.2

1.0.2.0

Square API integration with Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration

12/09 2017

v1.0.1

1.0.1.0

Square API integration with Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration

10/07 2017

v1.0.0

1.0.0.0

Square API integration with Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikola Gavric

laravel square square laravel integration