jadessoriano/mobivate-sdk-php

Mobivate SDK for PHP

1.1.1 2025-04-20 02:16 UTC

This package is auto-updated.

Last update: 2025-04-20 02:19:17 UTC


README

Mobivate SDK PHP

Mobivate Bulk SMS SDK for PHP

Latest Version on Packagist Tests Total Downloads

Mobivate Bulk SMS SDK for PHP:

TODO List:

  • Search Message Logs
  • Search for Single Message Log

Additional:

Installation

You can install the package via composer:

composer require jadessoriano/mobivate-sdk-php

Single Send SMS Message

use Jadessoriano\Mobivate\Client\Credentials\Basic;
use Jadessoriano\Mobivate\Client\Sms\SendSingle;
use Jadessoriano\Mobivate\MobivateClient;
use Jadessoriano\Mobivate\Requests\Sms\Message;

$client = new MobivateClient(
    new Basic('api_live_abcd1234efgh5678ijkl9012mnop3456')
);

$response = (new SendSingle($client))
    ->execute(
        new Message(
            originator: 'Test',             // Optional: defaults to config value if not provided
            recipient: '44700011122',
            body: 'This is a test message',
            reference: 'sample',            // Optional: defaults to null if not provided
            campaignId: '1-xxx'             // Optional: defaults to null if not provided
        )
    )

Send Batch SMS Messages

use Jadessoriano\Mobivate\Client\Credentials\Basic;
use Jadessoriano\Mobivate\Client\Sms\SendBatch;
use Jadessoriano\Mobivate\MobivateClient;
use Jadessoriano\Mobivate\Requests\Sms\Batch\BatchMessage;
use Jadessoriano\Mobivate\Requests\Sms\Batch\BatchMessageItem;

$client = new MobivateClient(
    new Basic('api_live_abcd1234efgh5678ijkl9012mnop3456')
);

/**
 * Note: The schedule date time (for later delivery) is optional, defaults to null if not provided.
 */
$message = (new BatchMessage())
    ->setMessages([
        new BatchMessageItem(
            originator: 'Test', // Optional: defaults to config value if not provided
            recipient: '44700011122',
            text: 'This is a test message'
        )
    ])
    ->setScheduleDateTime(
        new DateTime('+5 minutes', new DateTimeZone('Asia/Manila'))
    )

$response = (new SendBatch($client))->execute($message)

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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