PHP code example of bhavinjr / laravel-ekomi

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

    

bhavinjr / laravel-ekomi example snippets


'providers' => [
    // ...
    Bhavinjr\Ekomi\Providers\EkomiServiceProvider::class,
];

'aliases' => [
    //...
    "Ekomi": "Bhavinjr\Ekomi\Facades\Ekomi",
];

use Bhavinjr\Ekomi\Services\PutProduct;
use Ekomi;

$putProduct = new PutProduct();
$putProduct->setProductId(1)
           ->setProductName('t-shirt')
           ->setProductOther('json or serialized array') //optional. if has additional data such as categories, image_urls etc..
           ->setProductCanonicalLink('www.laravel-ekomi.com/t-shirt'); //optional

Ekomi::create($putProduct);

$putOrder = new PutOrder();
$putOrder->setOrderId(1)
         ->setProductIds(1) //if more than on products '1,2'
         ->setOrderTimestamp('2018-08-16'); // YYYY-MM-DD

Ekomi::create($putOrder);

$putComment = new PutComment();
$putComment->setOrderId(1)
           ->setComment('laravel+ekomi') //Must be urlencoded.
           ->setUpdate('replace or delete'); //optional

Ekomi::create($putComment);

$putDialog = new PutDialog();
$putDialog->setOrderId(1)
          ->setMessage('laravel+ekomi'); //Must be urlencoded

Ekomi::create($putDialog);

$putClient = new PutClient();
$putClient->setClientId(1)
          ->setEmail('[email protected]'); //optional

Ekomi::create($putClient);

also check other optional properties: 
setLocale, setScreenName, setFirstName, setLastName, setCountry, setCity, setZip, setGender, setBirthdate, setMetadata 

$assignOrder = new AssignClientOrder();
$assignOrder->setOrderId(1)
            ->setClientId(1)
            ->setUnlink(false); //true if want to removes the order_id assignment

Ekomi::create($assignOrder);

$getAverage = new GetAverage();
$getAverage->setDays(8); //optional

Ekomi::create($getAverage);

$getDialog = new GetDialog();
$getDialog->setContent('process_only') //optional
	  ->setRange('all') //optional
	  ->setFilter('all'); //optional

Ekomi::create($getDialog);

$getFeedback = new GetFeedback();
$getFeedback->setCaching('verylong') //optional available none, short, middle, long, verylong
	    ->fields('date,order_id'); //optional
		  	
Ekomi::create($getFeedback);

also check other optional properties: 
setFilter, setRange
shell
php artisan config:cache
shell
php artisan vendor:publish --provider="Bhavinjr\Ekomi\Providers\EkomiServiceProvider"
shell
php artisan config:cache