PHP code example of roichamp / php-client

1. Go to this page and download the library: Download roichamp/php-client 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/ */

    

roichamp / php-client example snippets


$roichamp = new \RoiChamp\Client([
    'token' => 'API_KEY'
]);

$roichamp->upsertSubscriber([
    'email' => '[email protected]',
    'first_name' => 'Roi',
    'last_name' => 'Champ',
    'phone' => '+381123123',
    'metaData' => [
        'source' => 'google'
    ],
])

$roichamp->unsubscribe('[email protected]')

$roichamp->upsertProduct([
    'identity' => '42141',
    'title' => 'Product title',
    'image' => '...',
    'permalink' => '...',
    'suggest' => 1,
    'metaData' => [
        'foo' => 'bar'
    ],
])

$roichamp->upsertProduct([
    'identity' => '14214',
    'title' => 'Product title',
    'price' => 199,
    'price_promo' => 99,
    'currency' => 'USD',
    'image' => '...',
    'permalink' => '...',
    'content' => 'Product description',
    'suggest' => 1,
    'categoryIdentities' => ['42141'],
    'metaData' => [
        'foo' => 'bar'
    ],
])

$roichamp->sendEmail([
    'identity' => 'reset_password',
    'to' => '[email protected]',
    'params' => [
        'reset_url' => '...',
    ],
])

composer