form-synergy / php-api
API client written in PHP to manage Form Synergy services.
Requires
- php: >=7.0
- form-synergy/fs-storage: ^1.5
- guzzlehttp/guzzle: ~6.0
Replaces
- form-synergy/php-api: 1.6.0.1
README
A PHP library to manage Form Synergy services.
Install using composer
composer require form-synergy/php-api
Include the library
require '/vendor/autoload.php';
Enable session management
\FormSynergy\Session::enable();
Import the Form Synergy class
use \FormSynergy\Fs as FS;
You will need to retrieve your credentials in the Form Synergy console.
Form Synergy Website: https://formsynergy.com/
- $profileid = '';
- $apikey = '';
- $apisecret = '';
If you are a reseller
- $resellerid = '';
Configuration
FS::Config([ 'version' => 'v1', 'protocol' => 'https', 'endpoint' => 'api.formsynergy.com', 'apikey' => $apikey, 'secretkey' => $secretkey, 'max_auth_count' => 15, ]);
local storage
Enable local storage to store downloads and responses.
FS::Storage( '/', 'local-storage' );
Load account
Load and start managing an account.
$api = FS::Api()->Load($profileid);
Add a domain
$api->Create('website') ->Attributes([ 'name' => 'MyWebsite', 'domain' => 'example.website.ltd', 'proto' => 'https://' ]) ->As('website');
Meta tag
Add the site id meta tag as follow
<meta name="fs:siteid" content="<?php echo $api->_website('siteid');?>">
Verify
$api->Get('website') ->Where([ 'siteid' => $api->_website('siteid') ]) ->verify();
Create a strategy
A strategy is composed of modules and objectives.
$api->Create('strategy') ->Attributes([ 'name' => 'Default strategy', 'siteid' => $api->_website('siteid') ]) ->As('defaultStrategy');
Creating modules
Modules are bundles composed of a subject, body and form inputs. Each module can be customized to handle events and responses individually. Modules can be chain linked together to create contiuous interactions. API documentation
Create an objective
An objective allows you to define notification methods, and goals based on obtained information. API documentation