Laravel 4Jawaly sms Library https://www.4jawaly.net
This is a Laravel ๐ฅ package to send SMS using https://www.4jawaly.net ๐ฅณ account
- Install the package using composer:
- for apps with
Laravel 8
and before:
composer require alkoumi/laravel-4jawaly-sms:1.4
- for apps from
Laravel 9
:
composer require alkoumi/laravel-4jawaly-sms
- The service provider will automatically registered. Or you may manually do in your
config/app.php
file:
'providers' => [
//...
Alkoumi\Laravel4jawalySms\Laravel4jawalySmsServiceProvider::class,
];
- Publish ๐ฅณ the configuration ๐ผ file using this command:
php artisan vendor:publish --provider='Alkoumi\Laravel4jawalySms\Laravel4jawalySmsServiceProvider'
- In your
.env
file add your https://www.4jawaly.net credentials details like:
4JAWALY_SMS_USERNAME=@username
4JAWALY_SMS_PASSWORD=@password
4JAWALY_SMS_FORMALSENDER=@formal-sender
4JAWALY_SMS_ADSSENDER=@Ads-sender
[email protected]
5- Don't forget to php artisan optimize:clear
after editing .env
file
use Alkoumi\Laravel4jawalySms\Facades\JawalySms;
$message = 'ุฌุนู ุงููู ู
ุง ูุฏู
ุชูู
ููุฑูุง ุฌุงุฑููุง ู
ู ุงูุญุณูุงุช';
# in multiple Lines with collection
JawalySms::message($message) // ๐ฅ { required } the test message to send
->to(User::all()) // ๐ฅ { required } as Mixed|array|object|collection
->asFormal() // { optional } the Ads-sender used by default unless you add ->asFormal()
->send(); // ๐ฅ { required } at the end to send ๐ง
# in One Liner with Builder
JawalySms::message($message)->to(DB::table('users')->get())->send();
{{ JawalySms::getBalance() }} // Return poients (int) 134534
1- For one recipient, You must pass types Mixed|Array
like ->to('0500175200')
or ->to(['0500175200'])
.
2- If you have database
field $user->mobile
then you can pass types Array|Object|Collection|Builder
.
3- For multiple recipients, Just pass types Array|Object|Collection
in ->to(User::all())
.
4- If you pass types of Array|Object|Collection
, We will tack care ๐ of getting mobile numbers.
5- By default Ads sender name will used, unless you add ->asFormal()
to use formal sender name from https://www.4jawaly.net.
6- Add admin_email
in .env
OR config\4jawaly-sms.php
to notify Admin with results in every request.
1- cd to the package directory and composer install
.
2- Add you 4Jawaly account details in SMSTestCase::class
in protected function defineEnvironment($app)
.
3- run vendor/bin/phpunit --filter
ENJOY ๐คฉ๐ฅณ.