PHP code example of rivio / rivio-php-sdk

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

    

rivio / rivio-php-sdk example snippets




y credentials from Rivio Dashboard (http://dashboard.getrivio.com/dashboard/settings/business)
$rivio = new Rivio('api_key','secret_key');

//Get the RIVIO script
$rivio_init_script=$rivio->get_init_js();

$rivio_embed_html=$rivio->product_reviews_widget(
    "1492411012", //$product_id REQUIRED
    "Samsung Galaxy S6", //$product_name REQUIRED
    "https://example.com/products/galaxy-s6", //$product_url OPTIONAL
    "https://images.example.com/big/200", //$product_image_url OPTIONAL
    "This is the product description", //$product_description OPTIONAL
    "1234567890123", //$product_barcode OPTIONAL
    "Mobile phone", //$product_category OPTIONAL
    "Samsung", //$product_brand OPTIONAL
    "499", //$product_price OPTIONAL
    $reviews_html //$reviews_html OPTIONAL (from product_reviews_html)
);




y credentials from Rivio Dashboard (http://dashboard.getrivio.com/dashboard/settings/business)
$rivio = new Rivio('api_key','secret_key');

$result = $rivio->register_post_purchase_email(
    "1492411013331", //$order_id REQUIRED
    "2015-09-28T09:16:16-04:00", //$ordered_date REQUIRED
    "[email protected]", //$customer_email REQUIRED
    "John", //$customer_first_name REQUIRED
    "1492411012", //$product_id REQUIRED
    "Samsung Galaxy S6", //$product_name REQUIRED
    "https://example.com/products/galaxy-s6", //$product_url OPTIONAL
    "https://images.example.com/big/200", //$product_image_url OPTIONAL
    "This is the product description", //$product_description OPTIONAL
    "1234567890123", //$product_barcode OPTIONAL
    "Mobile phone", //$product_category OPTIONAL
    "Samsung", //$product_brand OPTIONAL
    "499" //$product_price OPTIONAL
);




y credentials from Rivio Dashboard (http://dashboard.getrivio.com/dashboard/settings/business)
$rivio = new Rivio('api_key','secret_key');

$products = array();

// The first product
array_push($products, array(
   "id" => "1492411013331", //$product_id REQUIRED
   "name" => "Samsung Galaxy S6", //$product_name REQUIRED
   "url" => "https://example.com/products/galaxy-s6", //$product_url OPTIONAL
   "image_url" => "https://images.example.com/big/200", //$product_image_url OPTIONAL
   "description" => "This is the product description", //$product_description OPTIONAL
   "barcode" => "1234567890123", //$product_barcode OPTIONAL
   "brand" => "Samsung", //$product_brand OPTIONAL,
   "price" => "499", //$product_price OPTIONAL
));

// The second product
array_push($products, array(
   "id" => "2811046815449", //$product_id REQUIRED
   "name" => "Google Pixel", //$product_name REQUIRED
   "url" => "https://example.com/products/pixel", //$product_url OPTIONAL
   "image_url" => "https://images.example.com/big/300", //$product_image_url OPTIONAL
   "description" => "This is the product description", //$product_description OPTIONAL
   "barcode" => "9876543210987", //$product_barcode OPTIONAL
   "brand" => "Google", //$product_brand OPTIONAL,
   "price" => "799", //$product_price OPTIONAL
));

$result = $rivio->register_post_purchase_email_multiple_product(
    "1492411013331", //$order_id REQUIRED
    "2015-09-28T09:16:16-04:00", //$ordered_date REQUIRED
    "[email protected]", //$customer_email REQUIRED
    "John", //$customer_first_name REQUIRED
    $products
);

javascript
{
  "io-php-sdk": "*"
  }
}