PHP code example of portospire / suitecrmclient

1. Go to this page and download the library: Download portospire/suitecrmclient library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

portospire / suitecrmclient example snippets


$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$filter = new \PortoSpire\SuiteCRMClient\Model\Filter(['campaign_type' => 'Web']);
$json = $SuiteCRMClient->getCampaigns([], ['size' => 20, 'number' => 1], 'name', $filter); // this will contain json of the results
$campaignsFull = $SuiteCRMClient->convertJsonToGenerics($json); // this converts the json to PHP objects

$values = (array) $WebToLead; // expects an array of key=>value pairs where the keys match the different fields from the web-to-lead form
$SuiteCRMClient->setServerDomain($server_domain);
$SuiteCRMClient->setClientId($client_id);
$SuiteCRMClient->setClientSecret($client_secret);
$SuiteCRMClient->submitWebToLead($values, $campaign_id); // this must match the campaign id that the web-to-lead form is associated to in SuiteCRM

$aggregator = new ConfigAggregator([
...
\PortoSpire\SuiteCRMClient\ConfigProvider::class,
...