PHP code example of venditan / rapport-client

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

    

venditan / rapport-client example snippets


// Create the client with your supplied client id and api key
$obj_client = new \Venditan\Rapport\Client('company', 'api-key');

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('[email protected]')->mobile('07019551985');

// Set-up the transaction
$obj_client->addTransaction()->id('2015')->courier('Western Union')->tracking('ELB1885');

// Set the type of event and publish
$obj_client->event('order_dispatched')->send();

// Set-up the transaction
$obj_txn = $obj_client->addTransaction()->id('2015');

// Address
$obj_txn->deliverTo('123 Street, Town, County, POST CODE');

// Notes
$obj_txn->notes('Will be delivered by hand');

// Line. Only the description is 

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('[email protected]')->mobile('07019551985');

// Set-up the transaction
$obj_client->addTransaction()->id('2015')->estimatedDelivery('10th May 2016');

// Set the type of event and publish
$obj_client->event('stock_arrived')->send();

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('[email protected]')->mobile('07019551985');

// Set-up the transaction (optional, useful context)
$obj_client->addTransaction()->id('2015');

// Set a service message
$obj_client->addMessage()->title('Order Update')->body('Hi Marty. I am safe in 1885.')->from('ELB');

// Set the type of event and publish
$obj_client->event('service_message')->send();

// Retrieve any thread for Order "2015"
$obj_client->getThreadForTransaction('2015');

// Retrieve any thread for User "12345"
$obj_client->getThreadForUser('12345');

// Retrieve basic account usage data
$obj_client->getAccountUsage();
json
{
    "id": "oid-2015",
    "topic": "Order 2015",
    "last_read": "2015-01-01 12:00:00",
    "last_read_device": "Mobile, iPhone",
    "messages": [
        {
            "title": "Order Accepted",
            "message": "Thank you for your order.",
            "created": "2015-01-01 12:00:00"
        }
    ]
}