|
|
9 months ago | |
|---|---|---|
| .. | ||
| src | 9 months ago | |
| .gitignore | 10 months ago | |
| composer.json | 10 months ago | |
| readme.md | 10 months ago | |
This package is created as an easy wrapper for EKNotifier Service. It can be used in Laravel project or any PHP projects utilizing composer.
Include the repository as a VCS repository and require the version as dev-master
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ElkenGit/eknotifier-php"
}
],
"require": {
...
"elkengit/eknotifier-php": "dev-master"
}
Then run composer update.
Run php artisan vendor:publish --provider="ElkenGit\EknotifierPHP\EknotifierPhpServiceProvider"
This will create a eknotifier.php file under your config directory, fill it up.
SMS
<?php
use ElkenGit\EknotifierPHP\EknotifierSms;
// Instantiate without Laravel
$sms = new EknotifierSms(EKNOTIFIER_URL, APPLICATION_CODE, APPLICATION_PASSWORD);
// Instantiate with Laravel -- Must have config/eknotifier.php config filled
$sms = new EknotifierSms;
$phoneNumber = '0123456789'; // String, REQUIRED
$text = 'TEST SMS TEXT'; // String, REQUIRED
$userId = 1; // Integer, OPTIONAL (will be set to 0 if it's not given)
// Send the sms.
$sms->sendSMS($phoneNumber, $text, $userId); // Returns boolean
````
EMAIL
php <?php
use ElkenGit\EknotifierPHP\EknotifierEmail;
// Instantiate without Laravel $email = new EknotifierEmail(EKNOTIFIER_URL, APPLICATION_CODE, APPLICATION_PASSWORD);
// Instantiate with Laravel -- Must have config/eknotifier.php config filled $email = new EknotifierEmail;
// An array of recipients $emailsRecipients = [
['email' => 'user@email.com', 'user_id' => 1],
['email' => 'guest@email.com', 'user_id' => null],
];
$subject = 'EMAIL SUBJECT'; // String, REQUIRED $text = 'TEST EMAIL TEXT'; // String, REQUIRED
// Send the email. $email->sendEmail($emailsRecipients, $subject, $text); // Returns boolean ````