Skip to content
/ zeromsg Public

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.

License

Notifications You must be signed in to change notification settings

megoxv/zeromsg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZeroMsg Laravel

Latest Stable Version PHP Version Require License Downloads

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.

Installation

Step 1: Require the Package

You can install the package via Composer. Run the following command in your terminal:

composer require megoxv/zeromsg

Step 2: Configuration

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

Usage

To use the ZeroMsg package, include the ZeroMsg facade in your Laravel project.

Sending a Text Message

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Hello, this is a test message')
    ->to('34676010101')
    ->send();

Sending an Image

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this image!')
    ->image('https://example.com/image.jpg', 'image.jpg')
    ->to('34676010101')
    ->send();

Sending a Voice Message

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->voice('https://example.com/voice.mp3')
    ->to('34676010101')
    ->send();

Sending a Media Message

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this media file!')
    ->media('https://example.com/media.mp4', 'media.mp4')
    ->to('34676010101')
    ->send();

Sending a List Message

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();

Sending a Link Preview

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->message('Check out this link!')
    ->linkPreview('https://zeromsg.com')
    ->to('34676010101')
    ->send();

Sending a Location

use Megoxv\ZeroMsg\Facades\ZeroMsg;

ZeroMsg::create()
    ->location('37.7749', '-122.4194', 'San Francisco', 'California, USA')
    ->to('34676010101')
    ->send();

Publish Assets

you can publish config file by use this command

php artisan vendor:publish --tag="zeromsg-config"

Credits

License

The MIT License (MIT). Please see License File for more information.

About

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.

Resources

License

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Languages