PHP code example of oscar-team / customerio-laravel

1. Go to this page and download the library: Download oscar-team/customerio-laravel 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/ */

    

oscar-team / customerio-laravel example snippets


$customerIo = CustomerIo::workspace();

$customerIo = CustomerIo::workspace('us_market');

$isCustomer = $customerIo->searchCustomerByEmail($email);

$customerData = [
    'id' => 1
    'email' => '[email protected]',
    'first_name' => 'john',
    'last_name' => 'doe',
];
$customerIo->addCustomer($customerData);

$customerData = [
    'id' => 1
    'email' => '[email protected]',
    'first_name' => 'Doe',
    'last_name' => 'John',
];
$customerIo->updateCustomer($customerData);

$eventData = [
    'id' => 1
    'email' => '[email protected]',
    'name' => 'Event Created',
    'data' => []
];
$customerIo->createEvent($eventData);

$emailData = [
    'transactional_message_id' => 123, // can also be a string depending how the template is configured in Customer.io
    'identifiers' => [ // you need to send only one of these, depending which one you want and use in Customer.io
        'id' => 'your_own_custom_id_in_cio',
        'email' => '[email protected]',
        'cio_id' => 'customer_id_generated_by_cio',
    ],
    'to' => '\"Destination Person\" <[email protected]>',
    'body' => '<p>This is my test email</p>', //  with the actual name of the parameter and `<parameterValue>` with the actual value of the parameter
    ],
];
bash
php artisan vendor:publish --tag=customerio-config