Skip to content

bhavinjr/laravel-ekomi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

laravel-ekomi

Latest Stable Version Total Downloads License

lararvel-ekomi based on eKomi_APIv3

Installation

First, you'll need to install the package via Composer:

$ composer require bhavinjr/laravel-ekomi

If you are don't use using Laravel 5.5.* Then, update config/app.php by adding an entry for the service provider.

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

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

In command line paste this command:

php artisan config:cache

In command line again, publish the default configuration file:

php artisan vendor:publish --provider="Bhavinjr\Ekomi\Providers\EkomiServiceProvider"

Configuration

Configuration was designed to be as flexible. global configuration can be set in the config/ekomi.php file.

after update config/ekomi.php file.

php artisan config:cache

Usage

The package gives you the following methods to use:

PutProduct

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

$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

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

Ekomi::create($putComment);

PutDialog

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

Ekomi::create($putDialog);

PutClient

$putClient = new PutClient();
$putClient->setClientId(1)
          ->setEmail('bhavin@gmail.com'); //optional

Ekomi::create($putClient);

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

AssignClientOrder

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

Ekomi::create($assignOrder);

GetAverage

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

Ekomi::create($getAverage);

GetDialog

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

Ekomi::create($getDialog);

GetFeedback

$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

Also other methods is available

GetMarketResearch, GetProduct, GetProductFeedback, GetProductResearch, GetRated, GetResearch, GetSettings, GetSnapshot, GetVisitorFeedback

also use setType and setCharset properties to any methods 

=> setType is used for output

	default type set is 'json' (json or serialized)

=> setCharset is used for Character encoding

	default charset set is 'iso'