dizatech / notifier
v0.6
2021-06-22 10:19 UTC
Requires
- php: 7.1.*|7.2.*|7.3.*|7.4.*
- ghasedak/php: 1.*
- laravel/framework: 7.*|8.*
README
This is a Laravel Package for SMS Service Integration.
List of available drivers
How to install and config dizatech/notifier package?
Installation
composer require dizatech/notifier
Publish Config file
php artisan vendor:publish --tag=dizatech_notifier
Migrate tables, to add notifier tables to database
php artisan migrate
How to use exists drivers from package
-
Set the configs in /config/dizatech_notifier.php
-
Use this sample code to send sms
Notifier::driver('{driver_name}(like ghasedak)') ->userId(user_id_integer) ->templateId({template_id_integer(must be defined in a seeder)}) ->params(['param1' => 'string', ... ,'param10' => 'string']) ->options(['method' => '{driver_method_name}(like otp)','hasPassword' => 'if_this_message_has_password(yes or no)']) ->send();
-
Ghasedak OTP method example :
Notifier::driver('ghasedak') ->userId(2) ->templateId(1) ->params(['param1' => 'passwdsd12ds']) ->options(['method' => 'otp','ghasedak_template_name' => 'registration', 'hasPassword' => 'yes']) ->send();
Parameters
Template Seeder
- Basic and standard structure :
public function run() { DB::table('notifier_sms_templates')->insertOrIgnore([ [ 'id' => 1, 'template_text' => 'جهت اطلاعات بیشتر به این وبسایت مراجعه کنید : [param1]', 'created_at' => now(), 'updated_at' => now(), ] ]); }
- id : used in templateId option
- template_text : add your parameters by number (up to 10) in your message text like [param1] or [param2]
Requirements:
- PHP v7.0 or above
- Laravel v7.0 or above
- ghasedak/php package packagist link