form-synergy/php-api

API client written in PHP to manage Form Synergy services.

1.6.0.1 2019-07-14 10:27 UTC

This package is auto-updated.

Last update: 2024-06-14 21:34:23 UTC


README

FormSynergy.com API PHP library

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