PHP code example of ishaarat / lara-ishaarat

1. Go to this page and download the library: Download ishaarat/lara-ishaarat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ishaarat / lara-ishaarat example snippets


'providers' => [
    ...
    Ishaarat\LaraIshaarat\Providers\IshaaratServiceProvider::class,
]

'alias' => [
    ...
    'Ishaarat' => Ishaarat\LaraIshaarat\Facades\WA::class,
]

// Eg. for SNS.
'auth_key' => env('ISHAARAT_AUTH_KEY', 'xxxxxx'),
'app_key' => env('ISHAARAT_APP_KEY', 'xxxx'),

# On the top of the file.
use Ishaarat\LaraIshaarat\Facades\WA;

////

# In your Controller.
WA::send("this message", function($waMsg) {
    $waMsg->to(['Number 1', 'Number 2']); # The numbers to send to.
});
# OR...
WA::send("this message")->to(['Number 1', 'Number 2'])->dispatch();


ishaaratWA()->send("this message", function($waMsg) {
    $waMsg->to(['Number 1', 'Number 2']); # The numbers to send to.
});

ishaaratWA()->send("this message")->to(['Number 1', 'Number 2'])->dispatch();


namespace App\Notifications;

use Ishaarat\LaraIshaarat\Builder;
use Illuminate\Bus\Queueable;
use Ishaarat\LaraIshaarat\Channels\WAChannel;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class InvoicePaid extends Notification
{
    use Queueable;

    /**
     * Get the notification channels.
     *
     * @param  mixed  $notifiable
     * @return array|string
     */
    public function via($notifiable)
    {
        return [WAChannel::class];
    }

    /**
     * Get the repicients and body of the notification.
     *
     * @param  mixed  $notifiable
     * @return Builder
     */
    public function toWhatsapp($notifiable)
    {
        return (new Builder)
            ->send('this message')
            ->to('some number');
    }
}

$builder = (new Builder)
    ->send('this message')
    ->to('some number');

WA::send($builder);


php artisan vendor:publish --provider="Ishaarat\LaraIshaarat\Providers\IshaaratServiceProvider"