Skip to content

Commit 91e0f67

Browse files
committed
Initial Commit
1 parent 7c85b21 commit 91e0f67

21 files changed

+1078
-3
lines changed

.editorconfig

+15
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

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml.dist export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/tests export-ignore

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/vendor
2+
build
3+
composer.phar
4+
composer.lock
5+
.idea

.scrutinizer.yml

+21
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

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
preset: laravel
2+
3+
linting: true

.travis.yml

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

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
All notable changes to `exponent-push-notifications` will be documented in this file
4+
5+
## 1.0.0 - 2017-XX-XX
6+
7+
- initial release

CONTRIBUTING.md

+55
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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) Aly Suleiman <[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

+104-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,106 @@
1-
# new-channels
1+
# Exponent push notifications channel for Laravel 5.3
22

3-
Discuss about new channel proposals our share your finished channels in the [proposal issue](https://github.com/laravel-notification-channels/new-channels/issues/6).
3+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/laravel-exponent-push-notifications.svg?style=flat-square)](https://packagist.org/packages/alymosul/laravel-exponent-push-notifications)
4+
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
5+
[![Build Status](https://travis-ci.org/Alymosul/laravel-exponent-push-notifications.svg?branch=master)](https://travis-ci.org/Alymosul/laravel-exponent-push-notifications)
6+
[![StyleCI](https://styleci.io/repos/96645200/shield?branch=master)](https://styleci.io/repos/96645200)
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/alymosul/laravel-exponent-push-notifications.svg?style=flat-square)](https://scrutinizer-ci.com/g/alymosul/laravel-exponent-push-notifications)
9+
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/alymosul/laravel-exponent-push-notifications/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/alymosul/laravel-exponent-push-notifications/?branch=master)
10+
[![Total Downloads](https://img.shields.io/packagist/dt/alymosul/laravel-exponent-push-notifications.svg?style=flat-square)](https://packagist.org/packages/alymosul/laravel-exponent-push-notifications)
411

5-
Take a look at our [FAQ](http://laravel-notification-channels.com/) to see our small list of rules, to provide top-notch notification channels.
12+
## Contents
13+
14+
- [Installation](#installation)
15+
- [Usage](#usage)
16+
- [Available Message methods](#available-message-methods)
17+
- [Changelog](#changelog)
18+
- [Testing](#testing)
19+
- [Security](#security)
20+
- [Contributing](#contributing)
21+
- [Credits](#credits)
22+
- [License](#license)
23+
24+
25+
## Installation
26+
You can install the package via composer:
27+
```bash
28+
composer require laravel-notification-channels/exponent-push-notifications
29+
```
30+
You must install the service provider:
31+
32+
```php
33+
// config/app.php
34+
'providers' => [
35+
...
36+
NotificationChannels\ExpoPushNotifications\ExpoPushNotificationsServiceProvider::class,
37+
],
38+
```
39+
40+
## Usage
41+
42+
``` php
43+
use NotificationChannels\ExpoPushNotifications\ExpoChannel;
44+
use NotificationChannels\ExpoPushNotifications\ExpoMessage;
45+
use Illuminate\Notifications\Notification;
46+
47+
class AccountApproved extends Notification
48+
{
49+
public function via($notifiable)
50+
{
51+
return [ExpoChannel::class];
52+
}
53+
54+
public function toExpoPush($notifiable)
55+
{
56+
return ExpoMessage::create()
57+
->badge(1)
58+
->enableSound()
59+
->body("Your {$notifiable->service} account was approved!");
60+
}
61+
}
62+
```
63+
64+
### Available Message methods
65+
66+
A list of all available options
67+
- `body('')`: Accepts a string value for the body.
68+
- `enableSound()`: Enables the notification sound.
69+
- `disableSound()`: Mutes the notification sound.
70+
- `badge(1)`: Accepts an integer value for the badge.
71+
- `ttl(60)`: Accepts an integer value for the time to live.
72+
73+
### Managing Recipients
74+
75+
This package registers two endpoints that handle the subscription of recipients, the endpoints are defined in src/Http/routes.php file, used by ExpoController and all loaded through the package service provider.
76+
77+
### Routing a message
78+
79+
By default the exponent "interest" messages will be sent to will be defined using the {notifiable}.{id} convention, for example `App.User.1`, however you can change this behaviour by including a `routeNotificationForExpoPushNotifications()` in the notifiable class method that returns the interest name.
80+
81+
## Changelog
82+
83+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
84+
85+
## Testing
86+
87+
``` bash
88+
$ composer test
89+
```
90+
91+
## Security
92+
93+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
94+
95+
## Contributing
96+
97+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
98+
99+
## Credits
100+
101+
- [Aly Suleiman](https://github.com/Alymosul)
102+
- [All Contributors](../../contributors)
103+
104+
## License
105+
106+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "alymosul/exponent-push-notifications",
3+
"description": "Exponent push notifications driver for laravel",
4+
"homepage": "https://github.com/alymosul/exponent-push-notifications",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Aly Suleiman",
9+
"email": "[email protected]",
10+
"role": "Developer"
11+
}
12+
],
13+
"require": {
14+
"php": ">=7.0",
15+
"alymosul/exponent-server-sdk-php": "1.0.*",
16+
"illuminate/notifications": "5.3 || 5.4.*",
17+
"illuminate/support": "5.3 || 5.4.*",
18+
"illuminate/events": "5.3 || 5.4.*",
19+
"illuminate/queue": "5.3 || 5.4.*",
20+
"illuminate/http": "5.3 || 5.4.*",
21+
"illuminate/routing": "5.3 || 5.4.*",
22+
"illuminate/validation": "5.3 || 5.4.*",
23+
"illuminate/auth": "5.3 || 5.4"
24+
},
25+
"require-dev": {
26+
"mockery/mockery": "^0.9.5",
27+
"phpunit/phpunit": "~5.7"
28+
},
29+
"autoload": {
30+
"psr-4": {
31+
"NotificationChannels\\ExpoPushNotifications\\": "src"
32+
}
33+
},
34+
"autoload-dev": {
35+
"psr-4": {
36+
"NotificationChannels\\ExpoPushNotifications\\Test\\": "tests"
37+
}
38+
},
39+
"scripts": {
40+
"test": "vendor/bin/phpunit"
41+
},
42+
"config": {
43+
"sort-packages": true
44+
}
45+
}

phpunit.xml.dist

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="ExpoPushNotifications Test Suite">
14+
<directory suffix="Test.php">tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
<logging>
23+
<log type="tap" target="build/report.tap"/>
24+
<log type="junit" target="build/report.junit.xml"/>
25+
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
26+
<log type="coverage-text" target="build/coverage.txt"/>
27+
<log type="coverage-clover" target="build/logs/clover.xml"/>
28+
</logging>
29+
</phpunit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace NotificationChannels\ExpoPushNotifications\Exceptions;
4+
5+
class CouldNotSendNotification extends \Exception
6+
{
7+
}

0 commit comments

Comments
 (0)