v2.11.1 2022-09-14 13:23 UTC

This package is auto-updated.

Last update: 2024-09-14 18:04:25 UTC


README

GitHub issues GitHub stars GitHub forks GitHub license

This is a Laravel Package for SMS Service Integration.

List of available drivers

How to install and config sinarajabpour1998/notifier package?

Installation


composer require sinarajabpour1998/notifier

Publish Config file


php artisan vendor:publish --tag=notifier

Migrate tables, to add notifier tables to database


php artisan migrate

How to use exists drivers from package

  • Set the configs in /config/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