wearesho-team / message-delivery
Message Delivery Interfaces
Installs: 1 012
Dependents: 8
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Requires
- php: ^7.4 || 8.*
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
Suggests
- wearesho-team/alphasms-message-delivery: AlphaSMS Delivery\Service integration
- wearesho-team/telegram-message-delivery: Telegram bot api Delivery\Service integration
- wearesho-team/yii2-message-delivery: Yii2 implementation of Delivery\RepositoryInterface
This package is auto-updated.
Last update: 2024-10-09 15:48:41 UTC
README
This repository includes standard interfaces and implementations for simple message sending.
Installation
composer require wearesho-team/message-delivery
Contents
Interfaces
- Exception - exception that will be thrown by ServiceInterface if message can not be sent.
- MessageInterface - message entity that includes
recipient
andtext
fields. Can be extended with additional fields. - RepositoryInterface - messages repository. Stores history of message sending. Can be used as dependency in ServiceInterface implementations.
- ContainsSenderName - interface than extend Message with sender name getter
- CheckBalance - contain declaration of method
balance
for service for checking balance. Return Balance that containamount
andcurrency
.
Implementations
- MessageTrait - traits with getters for MessageInterface fields.
- SenderNameTrait - trait with getters for ContainsSenderName interface
- MessageWithSender - entity, that extends Message and uses SenderNameTrait
- Message - entity, that uses MessageTrait.
- ServiceMock - simple ServiceInterface implementation. Created for test purposes.
- MemoryRepository - simple RepositoryInterface implementation that allows to store history in memory. Created for test purposes.
- RepositoryTrait - simplifies RepositoryInterface implementation.
- BalanceTrait - trait with getters for BalanceInterface
Example
<?php require_once './vendor/autoload.php'; use Wearesho\Delivery; $service = new Delivery\ServiceMock(); $message = new Delivery\Message( $text = 'hello', $recipient = 'world' ); $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