pagewerx / uswerx-api-php
API Library Package for integrating with USWerx
Requires
- guzzlehttp/guzzle: ^7.8
- symfony/dotenv: ^7.2
Requires (Dev)
- phpunit/phpunit: ^11.0.2
README
Table of Contents
- README - (This Page) Project overview and getting started guide
- DraftOrder - Documentation for the DraftOrder class
- Order - Documentation for the Order class
Install and Setup
-
Require/Install the USWerx API Library for PHP using Composer:
composer require pagewerx/uswerx-api-php
-
Set Environment Variables
Create a
.env
file (or use an existing one) and include the following necessary environment variables:USWX_API_TOKEN=<api-token> USWX_HOST=<host>
-
Initialization:
To begin using the library you will first need to initialize it with the location of the
.env
file and optionally aLoggerInterface
object. This will load your environment variables, set your logger to what was provided, if left null theDefaultLogger
will be used. It is recommended to use a better logger than the providedDefaultLogger
class. You can create your own using it as a reference or simply create a wrapper for an existing logging library. This process will get an instance of the API Library's Context Singleton.UswerxApi::init(__DIR__ . '/path-to-your-env-file/.env');