The ZeroMsg Laravel package provides a fluent interface to interact with the ZeroMsg API, supporting various message types such as text, image, voice, media, list messages, link previews, and locations.
You can install the package via Composer. Run the following command in your terminal:
composer require megoxv/zeromsg
Add your ZeroMsg API key and Device ID to your .env
file:
ZEROMSG_API_KEY=your_api_key_here
ZEROMSG_DEVICE_ID=your_device_id_here
To use the ZeroMsg package, include the ZeroMsg
facade in your Laravel project.
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->message('Hello, this is a test message')
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->message('Check out this image!')
->image('https://example.com/image.jpg', 'image.jpg')
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->voice('https://example.com/voice.mp3')
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->message('Check out this media file!')
->media('https://example.com/media.mp4', 'media.mp4')
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->message('Check out this list!')
->listMessage(
'Options',
'Select',
[
[
'title' => 'Section 1',
'value' => 'option1',
'description' => 'First option'
],
[
'title' => 'Section 2',
'value' => 'option2',
'description' => 'Second option'
]
]
)
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->message('Check out this link!')
->linkPreview('https://zeromsg.com')
->to('34676010101')
->send();
use Megoxv\ZeroMsg\Facades\ZeroMsg;
ZeroMsg::create()
->location('37.7749', '-122.4194', 'San Francisco', 'California, USA')
->to('34676010101')
->send();
you can publish config file by use this command
php artisan vendor:publish --tag="zeromsg-config"
The MIT License (MIT). Please see License File for more information.