I'll tell you how to installation or setup this package into your project laravel, please follow this step.
- php >=7.4 | <8.4
- composer has been installed on your system
Install this package with composer and run this on your command.
composer require arifinhabibi/whatsapp
Next step on controller you must declare the origin static method
use arifinhabibi\whatsapp\Whatsapp;
second you can use this syntax into your function controller, and change parameter target number and message
Whatsapp::send("+628238749873", "Helloo world!");
send function have to parameters, on first need a number target which registered on whatsapp, second parameter is message. message can separated with space but not with a new line.
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use arifinhabibi\whatsapp\Whatsapp;
class MainController extends Controller
{
public function send(Request $request)
{
return Whatsapp::send($request->phone, $request->message);
}
}
Is number target must started with number code
Country | Number Code |
---|---|
Indonesia | +62, 62, 0, 8 |
Copyright © 2023 arifinhabibi.
This project is MIT licensed.