baorv/l5-klaviyo

Wrapper klaviyo API for Laravel 5

v1.0.0 2018-09-03 15:07 UTC

README

Wrapper Klaviyo API works with Laravel 5.*

Requirements

  • PHP 7.0.0 (or higher)
  • Laravel framework >= v5.0

Installation

"require": {
    "baorv/l5-klaviyo": "dev-master"
}

Configurations

Add ServiceProvider to config/app.php

'providers' => [
    \Baorv\Klaviyo\KlaviyoServiceProvider::class,
]

After that, run below command to publish vendor config

php artisan vendor:publish

Add two enviroment configurations: API Key and Public Key you can get it from : https://www.klaviyo.com/account#api-keys-tab

KLAVIYO_API_KEY={your-api-key}
KLAVIYO_PUBLIC_KEY={your-public-key}

Usage

$campaignApi = app(Secomapp\Klaviyo\Resources\Campaign::class);
$campaignApi->all();

With catching exception

try{
    $campaign = app(\Baorv\Klaviyo\Resources\Campaign::class);
    $campaign->all();
}catch (\Baorv\Klaviyo\Exceptions\KlaviyoApiException $exception) {
    $exception->getMessage();
}

License

This project is licensed under the MIT License.

Contribution

Todo

  • Add unit test
  • Travis