This quickstart sample creates a Square client instance with your Square access token and then lists the locations in your account. The sample is based on the PHP SDK Quickstart guide.
Install PHP - If you don't already have php installed on your machine
Install Composer - If you don't already have composer installed on your machine
-
Change into the
quickstart
directory -
copy
.env.example
to.env
and replace with your access tokenSQUARE_ACCESS_TOKEN=yourSandboxAccessToken
-
Install latest version of square dependencies
$ composer require square/square
-
Run the code
$ php -S localhost:8000
-
Navigate to
localhost:8000/quickstart.php
and you should output similar to this:LHI1YXJ8YSV5Z: Default Test Account, 1600 Pennsylvania Ave NW, Washington
Square PHP SDK Guide - details on how to use / configure the Square client.
Packagist Repository for Square - Where the package files are hosted
PHP SDK Source Code - Github repo with sdk source code