1. Go to this page and download the library: Download cutmeshort/sdk 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/ */
cutmeshort / sdk example snippets
CutMeShort\SDK\Client;
use CutMeShort\SDK\Models\LeadPayload;
// Initialize the SDK
$client = new Client(
accessToken: 'your-api-token',
host: 'https://www.cutmeshort.com'
);
// Track a lead
$leadPayload = new LeadPayload();
$leadPayload->setClickId('click_123456')
->setEventName('form_submission')
->setCustomerExternalId('customer_789')
->setCustomerName('John Doe')
->setCustomerEmail('[email protected]')
->setTimestamp(new DateTime());
$response = $client->getTrackingApi()->trackLead($leadPayload);
echo "Lead tracked: " . ($response->getSuccess() ? 'Success' : 'Failed') . "\n";
use CutMeShort\SDK\Models\SalePayload;
$salePayload = new SalePayload();
$salePayload->setClickId('click_123456')
->setEventName('purchase')
->setCustomerExternalId('customer_789')
->setInvoiceId('inv_001')
->setAmount(99.99)
->setCurrency('USD')
->setTimestamp(new DateTime());
$response = $client->getTrackingApi()->trackSale($salePayload);
$client = new Client();
$client->setAccessToken('your-bearer-token')
->setHost('https://api.cutmeshort.com');
$config = $client->getConfig();
// Set custom headers
$config->setUserAgent('MyApp/1.0.0');
// API key authentication (if needed)
$config->setApiKey('X-API-Key', 'your-api-key');
// Enable debug mode
$client->setDebug(true);
// Custom certificate for mTLS
$config->setCertFile('/path/to/cert.pem');
$config->setKeyFile('/path/to/key.pem');
$payload = new LeadPayload();
$payload->setClickId('click_id') // Required: Click identifier
->setEventName('signup') // Required: Event name
->setCustomerExternalId('customer_id') // Customer ID from your system
->setCustomerName('John Doe') // Customer name
->setCustomerEmail('[email protected]') // Customer email
->setCustomerAvatar('https://...') // Avatar URL
->setTimestamp(new DateTime()) // Event timestamp
->setMode('deferred'); // Optional: 'deferred' for first attribution