Skip to content

Commit 8d4511d

Browse files
author
Tint Naing Win
authored
Merge pull request #2 from tintnaingwinn/master
Initial release
2 parents ab2f390 + d8239a8 commit 8d4511d

21 files changed

+919
-2
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto
2+
3+
/tests export-ignore
4+
/docs export-ignore
5+
.editorconfig export-ignore
6+
.gitattributes export-ignore
7+
.gitignore export-ignore
8+
.styleci.yml export-ignore
9+
.travis.yml export-ignore
10+
phpunit.xml.dist export-ignore

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/vendor
2+
/.idea
3+
/.vagrant
4+
/build
5+
composer.phar
6+
composer.lock
7+
.DS_Stor
8+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
filter:
2+
excluded_paths: [tests/*]
3+
4+
checks:
5+
php:
6+
remove_extra_empty_lines: true
7+
remove_php_closing_tag: true
8+
remove_trailing_whitespace: true
9+
fix_use_statements:
10+
remove_unused: true
11+
preserve_multiple: false
12+
preserve_blanklines: true
13+
order_alphabetically: true
14+
fix_php_opening_tag: true
15+
fix_linefeed: true
16+
fix_line_ending: true
17+
fix_identation_4spaces: true
18+
fix_doc_comments: true
19+
20+
tools:
21+
external_code_coverage: true

.styleci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
preset: laravel
2+
3+
disabled:
4+
- simplified_null_return

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: php
2+
3+
php:
4+
- '7.2'
5+
- '7.3'
6+
7+
env:
8+
matrix:
9+
- COMPOSER_FLAGS="--prefer-stable"
10+
- COMPOSER_FLAGS=""
11+
12+
before_script:
13+
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source
14+
15+
script:
16+
- ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
17+
18+
after_script:
19+
- wget https://scrutinizer-ci.com/ocular.phar
20+
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `smspoh` will be documented in this file
4+
5+
## 1.0.0 - 2019-12-25
6+
7+
- initial release

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
Please read and understand the contribution guide before creating an issue or pull request.
6+
7+
## Etiquette
8+
9+
This project is open source, and as such, the maintainers give their free time to build and maintain the source code
10+
held within. They make the code freely available in the hope that it will be of use to other developers. It would be
11+
extremely unfair for them to suffer abuse or anger for their hard work.
12+
13+
Please be considerate towards maintainers when raising issues or presenting pull requests. Let's show the
14+
world that developers are civilized and selfless people.
15+
16+
It's the duty of the maintainer to ensure that all submissions to the project are of sufficient
17+
quality to benefit the project. Many developers have different skillsets, strengths, and weaknesses. Respect the maintainer's decision, and do not be upset or abusive if your submission is not used.
18+
19+
## Viability
20+
21+
When requesting or submitting new features, first consider whether it might be useful to others. Open
22+
source projects are used by many developers, who may have entirely different needs to your own. Think about
23+
whether or not your feature is likely to be used by other users of the project.
24+
25+
## Procedure
26+
27+
Before filing an issue:
28+
29+
- Attempt to replicate the problem, to ensure that it wasn't a coincidental incident.
30+
- Check to make sure your feature suggestion isn't already present within the project.
31+
- Check the pull requests tab to ensure that the bug doesn't have a fix in progress.
32+
- Check the pull requests tab to ensure that the feature isn't already in progress.
33+
34+
Before submitting a pull request:
35+
36+
- Check the codebase to ensure that your feature doesn't already exist.
37+
- Check the pull requests to ensure that another person hasn't already submitted the feature or fix.
38+
39+
## Requirements
40+
41+
If the project maintainer has any additional requirements, you will find them listed here.
42+
43+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer).
44+
45+
- **Add tests!** - Your patch won't be accepted if it doesn't have tests.
46+
47+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
48+
49+
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option.
50+
51+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
52+
53+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.
54+
55+
**Happy coding**!

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) Tint Naing Win <[email protected]>
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in
13+
> all copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
> THE SOFTWARE.

README.md

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,120 @@
1-
# smspoh
2-
Smspoh Notifications Channel for Laravel
1+
# Smspoh Notifications Channel for Laravel
2+
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/smspoh.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/smspoh)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
[![Build Status](https://img.shields.io/travis/laravel-notification-channels/smspoh/master.svg?style=flat-square)](https://travis-ci.org/laravel-notification-channels/smspoh)
6+
[![StyleCI](https://styleci.io/repos/:style_ci_id/shield)](https://styleci.io/repos/:style_ci_id)
7+
[![SensioLabsInsight](https://img.shields.io/sensiolabs/i/:sensio_labs_id.svg?style=flat-square)](https://insight.sensiolabs.com/projects/:sensio_labs_id)
8+
[![Quality Score](https://img.shields.io/scrutinizer/g/laravel-notification-channels/smspoh.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/smspoh)
9+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/laravel-notification-channels/smspoh/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/smspoh/?branch=master)
10+
[![Total Downloads](https://img.shields.io/packagist/dt/laravel-notification-channels/smspoh.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/smspoh)
11+
12+
This package makes it easy to send notifications using [SmsPoh](https://smspoh.com/) with Laravel 5.5+ and 6.0
13+
14+
## Contents
15+
16+
- [Installation](#installation)
17+
- [Setting up the smspoh](#setting-up-the-smspoh-service)
18+
- [Usage](#usage)
19+
- [Available Message methods](#available-message-methods)
20+
- [ On-Demand Notifications](#on-demand-notifications)
21+
- [Changelog](#changelog)
22+
- [Testing](#testing)
23+
- [Security](#security)
24+
- [Contributing](#contributing)
25+
- [Credits](#credits)
26+
- [License](#license)
27+
28+
29+
## Installation
30+
31+
You can install this package via composer:
32+
``` bash
33+
composer require laravel-notification-channels/smspoh
34+
```
35+
36+
### Setting up the Smspoh service
37+
38+
Add your Smspoh token, default sender name (or phone number) to your config/services.php:
39+
40+
```php
41+
// config/services.php
42+
...
43+
'smspoh' => [
44+
'endpoint' => env('SMSPOH_ENDPOINT', 'https://smspoh.com/api/v2/send'),
45+
'token' => env('SMSPOH_TOKEN', 'YOUR SMSPOH TOKEN HERE'),
46+
'sender' => env('SMSPOH_SENDER', 'YOUR SMSPOH SENDER HERE')
47+
],
48+
...
49+
```
50+
51+
## Usage
52+
53+
You can use the channel in your via() method inside the notification:
54+
55+
```php
56+
use Illuminate\Notifications\Notification;
57+
use NotificationChannels\Smspoh\SmspohMessage;
58+
59+
class AccountApproved extends Notification
60+
{
61+
public function via($notifiable)
62+
{
63+
return ["smspoh"];
64+
}
65+
66+
public function toSmspoh($notifiable)
67+
{
68+
return (new SmspohMessage)->content("Your account was approved!");
69+
}
70+
}
71+
```
72+
73+
In your notifiable model, make sure to include a routeNotificationForSmspoh() method, which returns a phone number or an array of phone numbers.
74+
75+
```php
76+
public function routeNotificationForSmspoh()
77+
{
78+
return $this->phone;
79+
}
80+
```
81+
### On-Demand Notifications
82+
Sometimes you may need to send a notification to someone who is not stored as a "user" of your application. Using the Notification::route method, you may specify ad-hoc notification routing information before sending the notification:
83+
84+
```php
85+
Notification::route('smspoh', '5555555555')
86+
->notify(new InvoicePaid($invoice));
87+
```
88+
### Available Message methods
89+
90+
`sender()`: Sets the sender's name. *Make sure to register the sender name at you SmsPoh dashboard.*
91+
92+
`content()`: Set a content of the notification message. This parameter should be no longer than 918 char(6 message parts),
93+
94+
`test()`: Send a test message to specific mobile number or not. This parameter should be boolean and default value is `true`.
95+
## Changelog
96+
97+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
98+
99+
## Testing
100+
101+
``` bash
102+
$ composer test
103+
```
104+
105+
## Security
106+
107+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
108+
109+
## Contributing
110+
111+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
112+
113+
## Credits
114+
115+
- [Tint Naing Win](https://github.com/tintnaingwinn)
116+
- [All Contributors](../../contributors)
117+
118+
## License
119+
120+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)