PHP code example of propellocloud / propello-php-sdk

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

    

propellocloud / propello-php-sdk example snippets


use PropelloCloud\Client;
// with Bearer Token
$client = new Client(bearerToken: $bearerToken);

// with client secret & ID 
$client = new Client(clientId: $clientId, clientSecret: $clientSecret);

use PropelloCloud\Client;

$client = new Client(clientId: $clientId, clientSecret: $clientSecret);

$bearerToken = $client->getBearerToken();

use PropelloCloud\Client;
$client = new Client(bearerToken: $bearerToken);

// Creates a user
$client->user->create(array $user);

// Create multiple users (max 100)
$client->user->createBulk(array $users, bool $sendEmails)

// Creates a user and returns user one-time login URL
$client->user->createUserWithLogin(array $user); 

// Returns a users details
$client->user->getUserByEmail(string $email);
$client->user->getUserByUid(string $uniqueId);
$client->user->getUserById(int $id);

// Returns a user one-time login URL
$client->user->getLoginByEmail(string $email);
$client->user->getLoginByUid(string $uniqueId);
$client->user->getLoginById(int $id);

// Deletes a user
$client->user->deleteByEmail(string $email);
$client->user->deleteByUid(string $uniqueId);
$client->user->deleteById(int $id);

// Restores a deleted user
$client->user->restoreByEmail(string $email);
$client->user->restoreByUid(string $uniqueId);
$client->user->restoreById(int $id);

// Anonymises a users details
$client->user->anonymiseByEmail(string $email);
$client->user->anonymiseByUid(string $uniqueId);
$client->user->anonymiseById(int $id);

// Restore anonymised user account with details
$client->user->makeKnownByUid(string $uniqueId, array $userDetails);
$client->user->makeKnownById(int $id, array $userDetails);

// Returns a paginated list of users
$client->user->list(array $filters);

// Returns redemption stats for a user
$client->user->getRedemptionStatsByEmail(string $email);
$client->user->getRedemptionStatsByUid(string $uniqueId);
$client->user->getRedemptionStatsById(int $id);

use PropelloCloud\Client;
$client = new Client(bearerToken: $bearerToken);

// Returns the current organisation group
$client->group->get();

// If your token has organisation or global access, pass the group ID explicitly
$client->group->get(int $organisationGroupId);

// Returns all organisation groups (

use PropelloCloud\Client;
$client = new Client(bearerToken: $bearerToken);

// Returns a paginated list of all orders for the group
$client->orders->listGroupOrders(array $filters);
// Available filters: per_page, page, order_created_from, order_created_to, order_status, brand_id, brand_name, organisation_group_id

// Returns orders for a specific user
$client->orders->listUserOrdersByEmail(string $email, array $filters);
$client->orders->listUserOrdersByUid(string $uniqueId, array $filters);
$client->orders->listUserOrdersById(int $id, array $filters);

use PropelloCloud\Client;
$client = new Client(bearerToken: $bearerToken);

// Returns a list of offers
$client->offers->list();

// If your token has organisation or global access, pass the group ID explicitly
$client->offers->list(int $organisationGroupId);

// Returns a single offer by ID
$client->offers->get(int $id);
$client->offers->get(int $id, int $organisationGroupId);

use PropelloCloud\Client;
$client = new Client(bearerToken: $bearerToken);

// Returns a list of interactions for a specific user
$client->interactions->listByEmail(string $email, array $filters);
$client->interactions->listByUid(string $uniqueId, array $filters);
$client->interactions->listById(int $id, array $filters);

// Stores an interaction for a specific user
$client->interactions->storeByEmail(string $email, array $interaction);
$client->interactions->storeByUid(string $uniqueId, array $interaction);
$client->interactions->storeById(int $id, array $interaction);
bash
composer