stampspv/wittylight

Wittylight

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.1903 2019-07-25 10:43 UTC

This package is auto-updated.

Last update: 2021-08-25 15:43:17 UTC


README

Latest Stable Version

WittyLight is a Laravel 5 Package for Send E-mail form Wittylight Server by API

Installation

Use the composer to install WittyMail.

composer require stampspv/wittylight

Usage

First of all , you will insert config setting to .env of you project.

WITTYLIGHT_TEST=true
WITTYLIGHT_TOKEN=xxxxxxxxxxxx

"xxxxxxx" is token of website security check form WittyLight Server, Don't forget to type commands php artisan config:clear after change .env

Next, You can use the sendmail method, but you will have to send the important data in this format.

$data = [
    'title'     => 'Testing',
    'name'      => 'Wittylight',
    'form'      => 'no-reply@wittylight.com',
    'html'      => view('emails.neworder',['order'=>$order])->render(),
];
$mail = WittylightController::sendmail('suphavich.c@gmail.com',$data);

If sending email successfully , The API will return the success json like this

array:2 [▼
  "status" => true
  "message" => "success"
]

But failed , The API will return the json with false status and error message like this

array:2 [▼
  "status" => false
  "message" => "email to and form is required"
]

WittyLog

WittyLog is Sending Message Logs system for maintenance project and notification to Wiitylight as developer when system are critical error.

Usage by

WittylightController::logs('error','message',false);

You can use with Exception handler , example that

try{
    $t->save();
}catch (\Exception $x){
    WittylightController::logs('error',$x->getMessage(),false);
}