PHP code example of fnklabs / monger

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

    

fnklabs / monger example snippets


$logger       = new Logger("test");
$curlAdapter  = new CurlAdapter($logger),
$mongerClient = new MongerClient(
                                "https://monger.fnklabs.com", 
                                "USER_TOKEN", 
                                "USER_ACCESS_TOKEN_WITH_WRITE_SCOPE", 
                                "YOUR_APPLICATION_NAME",
                                "YOUR_APPLICATION_VERSION",
                                $curlAdapter,
                                $logger
               );

$mongerClient->newCustomer(
            "CUSTOMER_INTERNAL_ID",
            "CUSTOMER_INITIALS",
            "CUSTOMER_EMAIL",
            "CUSTOMER_PHONE_NUMBER",
            CUSTOMER_GENDER,
            "CUSTOMER_COUNTRY",
            "CUSTOMER_CITY",
            "CUSTOMER_AGE",
            new \DateTime(),
            ["TAG_1", "TAG_2"]
        );

$mongerClient->newActivity("CUSTOMER_INTERNAL_ID", "ACTIVITY_NAME", new \DateTime());


$mongerClient->newPayment("CUSTOMER_INTERNAL_ID", "PAYMENT_INTERNAL_ID", PURCHASE_AMOUNT, new \DateTime());