wearesho-team / message-delivery
Message Delivery Interfaces
2.4.0
2026-10-26 13:22 UTC
Requires
- php: >=8.4
- nesbot/carbon: ^3.8
Requires (Dev)
- phpunit/phpunit: ^13.4
- squizlabs/php_codesniffer: ^4.0
Suggests
- wearesho-team/alphasms-message-delivery: AlphaSMS Delivery\Service integration
- wearesho-team/turbosms-message-delivery: TurboSMS Delivery\Service integration
- wearesho-team/yii2-message-delivery: Yii2 implementation of Delivery\RepositoryInterface
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-26 13:57:28 UTC
README
This repository includes standard interfaces and implementations for simple message sending.
Compatibility: tested on PHP 8.4, PHP 8.5
Installation
composer require wearesho-team/message-delivery:^2.4
Contents
Interfaces
- ServiceInterface - message delivery service:
name(),balance()andsend(). - Batch\ServiceInterface - extends
ServiceInterface with
batch()for sending several messages. - MessageInterface - message entity that includes
recipient,textandoptionsfields. Known option keys are listed in Options (sender name, channel, TTL). - ResultInterface - result of sending a message: message id, message, status and reason.
- BalanceInterface - service balance with
amountandcurrency. - History\RepositoryInterface - stores the history of sent messages as History\ItemInterface entries.
- Exception - exception thrown by ServiceInterface implementations if a message can not be sent.
Implementations
- Message, Result, Balance (with BalanceTrait) and History\Item - entities.
- Batch\Service - wraps any ServiceInterface and sends batches message by message (see also Batch\ServiceTrait).
- History\Service - decorates a batch service and stores every result in a History\RepositoryInterface.
- History\MemoryRepository - stores the history in memory. Created for test purposes.
- StubService - simple Batch\ServiceInterface
implementation that sends nothing and returns a
Deliveredresult for every message. Created for test purposes. - Test\History\RepositoryTest - abstract PHPUnit test case for History\RepositoryInterface implementations.
Example
<?php require_once './vendor/autoload.php'; use Wearesho\Delivery; $service = new Delivery\StubService(); $message = new Delivery\Message( text: 'hello', recipient: 'world' ); $result = $service->send($message);
Integrations
- wearesho-team/yii2-message-delivery - Delivery\RepositoryInterface implementation, Delivery\ServiceInterface implementation using async queue
- wearesho-team/alphasms-message-delivery - AlphaSMS integration
- wearesho-team/telegram-message-delivery - Telegram bot integration implemented in irazasyed/telegram-bot-sdk