1. Go to this page and download the library: Download kennetn/leadscore 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/ */
kennetn / leadscore example snippets
ore = new LeadScore\LeadScore(API_KEY);
$stages = $LeadScore->stages->view();
{
"leadscore": "^4.0"
}
}
$stages = $LeadScore->stages->view();
$owners = $LeadScore->owners->view();
$segments = $LeadScore->segments->view();
$fields = $LeadScore->lead->fields();
/**
* $fields = [
* 'email' => '[email protected]', // Email address
* 'full_name' => 'John Doe', // Full name (Converts the name into first and last name)
* 'first_name' => 'John', // First name
* 'last_name' => 'Doe', // Last name
* 'gender' => 'MALE', // Gender ('FEMALE', 'MALE' OR 'UNKNOWN')
* 'title' => 'Customer', // Title
* 'company' => 'LeadScore App', // Company
* 'address' => 'Bredgade 1', // Address
* 'zip' => '7400', // Zip code
* 'city' => 'Herning', // City
* 'country' => 'Denmark', // Country
* 'phone' => '12345678', // Phone
* 'phone_country_code' => '45', // Phone country code
* 'description' => 'Lorem ipsum', // Description
* '42' => '1.000,- DKK' // Customfield "Budget" with customfield ID '42'
* ];
*/
$response = $LeadScore->lead->add($fields, $stage_id = null, $owner_id = null, $segment_id = null, $sync = null);
setcookie('__lsk', $response['lead_key'], strtotime('+1 year'), '/'); // Save for one year
/**
* $leads = [ // One or more leads with either ID, key or email
* [
* 'id' => 42 // Lead ID
* ],
* [
* 'key' => '8001083940a98db179c0473d9bc75ccf' // Lead key
* ],
* [
* 'email' => '[email protected]' // Lead email address
* ]
* ];
*
* $stage_id = 42;
*/
$result = $LeadScore->lead->stage($leads, $stage_id); // ['leads' => 3, 'edited' => 3, 'same' => 0]
/**
* $leads = [ // One or more leads with either ID, key or email
* [
* 'id' => 42 // Lead ID
* ],
* [
* 'key' => '8001083940a98db179c0473d9bc75ccf' // Lead key
* ],
* [
* 'email' => '[email protected]' // Lead email address
* ]
* ];
*
* $segment_id = 42;
*/
$result = $LeadScore->lead->addToSegment($leads, $segment_id); // ['leads' => 3, 'changed' => 3, 'same' => 0]
/**
* $leads = [ // One or more leads with either ID, key or email
* [
* 'id' => 42 // Lead ID
* ],
* [
* 'key' => '8001083940a98db179c0473d9bc75ccf' // Lead key
* ],
* [
* 'email' => '[email protected]' // Lead email address
* ]
* ];
*
* $segment_id = 42;
*/
$result = $LeadScore->lead->removeFromSegment($leads, $segment_id); // ['leads' => 3, 'changed' => 3, 'same' => 0]