Getting Started - www-getstorify-com/getstorify-offers-php-sdk GitHub Wiki
Welcome to the documentation of getStorify Offers PHP SDK.
Setup
Unzip the downloaded PHP SDK zip file and take the SDK directory and put it in your project.
SDK directory name: GetStorifyOffers
Note! You can download the latest release here.
Your project file structure may look like the following after including the GetStorifyOffers directory.
/myproject
|
+-- GetStorifyOffers
| |
| +-- autoload.php
| |
| +-- GetStorifyOffers.php
| |
| +-- more files and directories
|
+-- index.php
Create API Service Credentials
Steps to create API Service credentials.
- Login to your getStorify account and go to the Settings page.
- Select API Service from the sidebar and click on CREATE APP button.
- Fill in your website details and click the CREATE button to get your app credentials for your website.
- When the credential is successfully created, click the MANAGE button to get your credentials values.
- Copy the User ID, App ID and App Token. These values will be used later when you start working with the SDK.
You are now ready to use the credentials.
Creating GS object
Let's say you want to use the API methods provided by the SDK in the index.php
file.
Inside the index.php
file include the autoload.php
file from the GetStorifyOffers SDK directory.
require_once __DIR__ . '/GetStorifyOffers/autoload.php';
Create the credentials constants for your UserID, AppID and AppToken.
define('GETSTORIFY_OFFERS_API_SERVICE_AUTH_APPID', '123');
define('GETSTORIFY_OFFERS_API_SERVICE_AUTH_USERID', 'gs123');
define('GETSTORIFY_OFFERS_API_SERVICE_AUTH_APPTOKEN', 'abc123def');
Create object of the GetStorifyOffers class using your credentials.
// create object
$GetStorifyOffersObj = new \GetStorifyOffers\GetStorifyOffers(
GETSTORIFY_OFFERS_API_SERVICE_AUTH_APPID,
GETSTORIFY_OFFERS_API_SERVICE_AUTH_USERID,
GETSTORIFY_OFFERS_API_SERVICE_AUTH_APPTOKEN
);