PHPackages                             wearesho-team/message-delivery - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wearesho-team/message-delivery

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wearesho-team/message-delivery
==============================

Message Delivery Interfaces

2.3.0(1y ago)01.3k↓100%[2 PRs](https://github.com/wearesho-team/message-delivery/pulls)5MITPHPPHP ^8.1CI passing

Since May 12Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/wearesho-team/message-delivery)[ Packagist](https://packagist.org/packages/wearesho-team/message-delivery)[ RSS](/packages/wearesho-team-message-delivery/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (25)Used By (5)

Message Delivery
================

[](#message-delivery)

[![Latest Stable Version](https://camo.githubusercontent.com/d4ba09ca5bb23e44adb5f80664a311476e3da60d4c0ac1abe7e9619aae4be081/68747470733a2f2f706f7365722e707567782e6f72672f776561726573686f2d7465616d2f6d6573736167652d64656c69766572792f762f737461626c652e706e67)](https://packagist.org/packages/wearesho-team/message-delivery)[![Total Downloads](https://camo.githubusercontent.com/dced1c01b4ff0b60de1600e468ca3980f69e056cdee02323ad9de657c946440d/68747470733a2f2f706f7365722e707567782e6f72672f776561726573686f2d7465616d2f6d6573736167652d64656c69766572792f646f776e6c6f6164732e706e67)](https://packagist.org/packages/wearesho-team/message-delivery)[![PHP Composer](https://github.com/wearesho-team/message-delivery/workflows/PHP%20Composer/badge.svg)](https://github.com/wearesho-team/message-delivery/workflows/PHP%20Composer/badge.svg)[![codecov](https://camo.githubusercontent.com/bfbb1c091958124679eec207a7c0ecfaea6abc0b8002dd2e522696a28cbc1165/68747470733a2f2f636f6465636f762e696f2f67682f776561726573686f2d7465616d2f6d6573736167652d64656c69766572792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/wearesho-team/message-delivery)

This repository includes standard interfaces and implementations for simple message sending.

Installation
------------

[](#installation)

```
composer require wearesho-team/message-delivery
```

Contents
--------

[](#contents)

### Interfaces

[](#interfaces)

- [Exception](./src/Exception.php) - exception that will be thrown by [ServiceInterface](./src/ServiceInterface.php) if message can not be sent.
- [MessageInterface](./src/MessageInterface.php) - message entity that includes `recipient` and `text` fields. Can be extended with additional fields.
- [RepositoryInterface](./src/RepositoryInterface.php) - messages repository. Stores history of message sending. Can be used as dependency in [ServiceInterface](./src/ServiceInterface.php) implementations.
- [ContainsSenderName](./src/ContainsSenderName.php) - interface than extend Message with sender name getter
- [CheckBalance](src/CheckBalance.php) - contain declaration of method `balance` for service for checking balance. Return [Balance](src/Balance.php) that contain `amount` and `currency`.

### Implementations

[](#implementations)

- [MessageTrait](./src/MessageTrait.php) - traits with getters for [MessageInterface](./src/MessageInterface.php) fields.
- [SenderNameTrait](./src/SenderNameTrait.php) - trait with getters for [ContainsSenderName](./src/ContainsSenderName.php) interface
- [MessageWithSender](./src/MessageWithSender.php) - entity, that extends [Message](./src/MessageWithSender.php)and uses [SenderNameTrait](./src/SenderNameTrait.php)
- [Message](./src/Message.php) - entity, that uses MessageTrait.
- [ServiceMock](./src/ServiceMock.php) - simple [ServiceInterface](./src/ServiceInterface.php)implementation. Created for test purposes.
- [MemoryRepository](./src/MemoryRepository.php) - simple [RepositoryInterface](./src/RepositoryInterface.php)implementation that allows to store history in memory. Created for test purposes.
- [RepositoryTrait](./src/RepositoryTrait.php) - simplifies [RepositoryInterface](./src/RepositoryInterface.php)implementation.
- [BalanceTrait](src/BalanceTrait.php) - trait with getters for [BalanceInterface](src/BalanceInterface.php)

### Example

[](#example)

```
