wpsinc / wps-php-sdk
The official PHP SDK for the WPS API
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
- illuminate/support: ~5.1
- league/container: ~1.3
- nesbot/carbon: ~1.19
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: ~4.6
This package is not auto-updated.
Last update: 2018-09-26 14:17:32 UTC
README
This is a simple PHP Client that can connect to the WPS API. This package was developed to be used with Laravel 5.1 but can also be used stand alone as well.
Installation
Just add this to your composer.json and then run composer update
"wpsinc/wps-php-sdk": "dev-master"
You can also simply add it like this
composer require "wpsinc/wps-php-sdk:dev-master"
Laravel Setup
This sdk comes with support for Laravel 5.1. This includes a service provider as well as a facade for easy access. Once this package is pulled into your project just add this to your config/app.php file.
'providers' => [
...
\Wps\WpsServiceProvider::class,
],
and then add the facade to your aliases array
'aliases' => [
...
'Wps' => \Wps\Facades\Wps::class,
],
Configuration
If you are using Laravel then add a teamwork array to your config/services.php file
...
'wps' => [
'base_uri'=>env('WPS_BASE_URI'),
'username'=>env('WPS_USER'),
'password'=>env('WPS_PASS'),
],
Use
If you are using the Facade with Laravel you can easily access WPS like this
Wps::product()->all();
Configuration Without Laravel
If you are not using Laravel you can instantiate the class like this
require "vendor/autoload.php";
use Wps\Sdk;
$wps = new Sdk([
'auth' => ['username', 'password']
]);
$wps->product()->all();
View the tests for other examples as the documentation continues to be developed.