Skip to content

Commit 9172e97

Browse files
authored
Merge pull request #4 from ker0x/develop
Develop
2 parents 544d986 + 16f54f3 commit 9172e97

File tree

96 files changed

+2652
-4905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2652
-4905
lines changed

.editorconfig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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
16+
17+
[*.{json,yml}]
18+
indent_style = space
19+
indent_size = 2

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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
11+
/docs export-ignore

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
.DS_Store
21
build/
32
vendor/
4-
composer.lock
3+
composer.lock
4+
.php_cs
5+
.php_cs.cache
6+
phpunit.xml

.php_cs.dist

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in(__DIR__ . '/src')
5+
;
6+
7+
return PhpCsFixer\Config::create()
8+
->setRiskyAllowed(true)
9+
->setRules([
10+
'@Symfony' => true,
11+
'@PHP71Migration' => true,
12+
'binary_operator_spaces' => array(
13+
'align_equals' => false,
14+
'align_double_arrow' => false,
15+
),
16+
'@Symfony:risky' => true,
17+
'@PHP71Migration:risky' => true,
18+
'array_syntax' => ['syntax' => 'short'],
19+
'linebreak_after_opening_tag' => true,
20+
'mb_str_functions' => true,
21+
'no_php4_constructor' => true,
22+
'no_unreachable_default_argument_value' => true,
23+
'no_useless_else' => true,
24+
'no_useless_return' => true,
25+
'ordered_imports' => true,
26+
'php_unit_strict' => true,
27+
'phpdoc_order' => true,
28+
'semicolon_after_instruction' => true,
29+
'strict_comparison' => true,
30+
'strict_param' => true,
31+
'concat_space' => ['spacing' => 'one'],
32+
'trailing_comma_in_multiline_array' => true,
33+
'yoda_style' => false
34+
])
35+
->setFinder($finder)
36+
->setCacheFile(__DIR__.'/.php_cs.cache');

.scrutinizer.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,43 @@
11
imports:
2-
- php
2+
- php
33

44
checks:
5-
php:
6-
code_rating: true
7-
duplication: true
5+
php:
6+
code_rating: true
7+
duplication: true
88

99
filter:
10-
excluded_paths:
11-
- tests/
10+
excluded_paths:
11+
- "tests/"
12+
dependency_paths:
13+
- "vendor/"
14+
1215
tools:
13-
php_mess_detector: true
14-
php_cpd:
15-
excluded_dirs:
16-
- tests/
17-
php_loc:
18-
excluded_dirs:
19-
- tests/
20-
php_pdepend:
21-
excluded_dirs:
22-
2: tests/
16+
php_mess_detector: true
17+
php_cpd:
18+
excluded_dirs:
19+
- tests/
20+
php_loc:
21+
excluded_dirs:
22+
- tests/
23+
php_pdepend:
24+
excluded_dirs:
25+
2: tests/
26+
27+
build:
28+
nodes:
29+
analysis:
30+
project_setup:
31+
override: true
32+
tests:
33+
override: [php-scrutinizer-run]
34+
coverage:
35+
tests:
36+
override:
37+
- command: 'vendor/bin/phpunit --coverage-clover=clover.xml'
38+
coverage:
39+
file: 'clover.xml'
40+
format: 'clover'
41+
environment:
42+
php:
43+
version: 7.1

.travis.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
language: php
22

3-
php:
4-
- 7.0
5-
63
sudo: false
74

5+
cache:
6+
directories:
7+
- $HOME/.composer/cache/files
8+
9+
php:
10+
- 7.1
11+
- 7.2
12+
813
env:
914
global:
10-
- DEFAULT=1
11-
- secure: j+1g/twymlVnvpQlsdS+82IY3xR8GIBB7m8bEmpYP6J1ketRToJWANDre6Xb/33JHEzekcr5Kt0F2UDkNzR5rNbviHqYH4EyHA7VZTikqSSelY+lZF7qo1xTyGRnCJZV6c2bri/rPVSjw1FYngNFh5FGCh7PmpzzeQZkhyCG3Cs=
15+
- secure: j+1g/twymlVnvpQlsdS+82IY3xR8GIBB7m8bEmpYP6J1ketRToJWANDre6Xb/33JHEzekcr5Kt0F2UDkNzR5rNbviHqYH4EyHA7VZTikqSSelY+lZF7qo1xTyGRnCJZV6c2bri/rPVSjw1FYngNFh5FGCh7PmpzzeQZkhyCG3Cs=
1216

1317
matrix:
1418
fast_finish: true
19+
allow_failures:
20+
- php: 7.2
1521

16-
include:
17-
- php: 7
18-
env: PHPCS=1 DEFAULT=0
19-
20-
- php: 7
21-
env: COVERALLS=1 DEFAULT=0
22+
before_install:
23+
- composer self-update
24+
- if [ "$GITHUB_COMPOSER_AUTH" ]; then composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH; fi
2225

2326
install:
24-
- composer self-update
25-
- composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH
26-
- composer install --prefer-dist --no-interaction --dev
27+
- composer install --prefer-dist --no-interaction
2728

2829
before_script:
29-
- sh -c "if [ '$PHPCS' = '1' ]; then composer require squizlabs/php_codesniffer:dev-master; fi"
30-
31-
- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls:dev-master; fi"
32-
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"
30+
- mkdir -p build/logs
3331

3432
script:
35-
- sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --stderr --coverage-clover build/logs/clover.xml; fi"
36-
- sh -c "if [ '$COVERALLS' = '1' ]; then php vendor/bin/coveralls -v; fi"
37-
- sh -c "if [ '$DEFAULT' = '1' ]; then phpunit --stderr; fi"
38-
- sh -c "if [ '$PHPCS' = '1' ]; then ./vendor/bin/phpcs -n -p --extensions=php --standard=PSR2 --ignore=vendor --ignore=tests . ; fi"
33+
- vendor/bin/php-cs-fixer fix --diff --dry-run
34+
- vendor/bin/phpcs -s --config-set ignore_warnings_on_exit 1
35+
- vendor/bin/phpunit --stderr --coverage-clover build/coverage/xml
36+
37+
after_script:
38+
- vendor/bin/codacycoverage clover build/coverage/xml
3939

4040
notifications:
4141
email: false

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# CHANGELOG
2+
3+
The Fcm library follows [SemVer](http://semver.org/).
4+
5+
## 2.x
6+
7+
Version `2.x` of this library is a full rewrite to be compliant with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages). If you are on Legacy HTTP API, then you should consider using version `1.x`
8+
9+
- 2.0.0 (2018-09)
10+
- Rewrite library to be compatible with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages)
11+
- Improve tests
12+
- Refactor code
13+
- Move documentation to the [Wiki](https://github.com/ker0x/fcm/wiki) section of the repo

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Romain Monteil
3+
Copyright (c) 2016-2018 Romain Monteil
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
1-
[![Build](https://img.shields.io/travis/ker0x/fcm/master.svg?style=flat-square)](https://travis-ci.org/ker0x/fcm)
2-
[![Coverage](https://img.shields.io/coveralls/ker0x/fcm/master.svg?style=flat-square)](https://coveralls.io/github/ker0x/fcm)
3-
[![Code Quality](https://img.shields.io/scrutinizer/g/ker0x/fcm.svg?style=flat-square)](https://scrutinizer-ci.com/g/ker0x/fcm/)
4-
[![Total Downloads](https://img.shields.io/packagist/dt/kerox/fcm.svg?style=flat-square)](https://packagist.org/packages/ker0x/fcm)
5-
[![Latest Stable Version](https://img.shields.io/packagist/v/kerox/fcm.svg?style=flat-square)](https://packagist.org/packages/ker0x/fcm)
6-
[![Documentation Status](https://readthedocs.org/projects/fcm/badge/?version=latest&style=flat-square)](http://fcm.readthedocs.org/en/latest/?badge=latest)
7-
[![License](https://img.shields.io/packagist/l/kerox/fcm.svg?style=flat-square)](https://packagist.org/packages/ker0x/fcm)
8-
9-
# FCM PHP library
1+
<div align="center">
2+
<a href="https://travis-ci.org/ker0x/fcm" title="Build">
3+
<img src="https://img.shields.io/travis/ker0x/fcm.svg?style=for-the-badge" alt="Build">
4+
</a>
5+
<a href="https://scrutinizer-ci.com/g/ker0x/fcm/" title="Coverage">
6+
<img src="https://img.shields.io/scrutinizer/coverage/g/ker0x/fcm.svg?style=for-the-badge" alt="Coverage">
7+
</a>
8+
<a href="https://scrutinizer-ci.com/g/ker0x/fcm/" title="Code Quality">
9+
<img src="https://img.shields.io/scrutinizer/g/ker0x/fcm.svg?style=for-the-badge" alt="Code Quality">
10+
</a>
11+
<a href="https://php.net" title="PHP Version">
12+
<img src="https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=for-the-badge" alt="PHP Version">
13+
</a>
14+
<a href="https://packagist.org/packages/kerox/fcm" title="Downloads">
15+
<img src="https://img.shields.io/packagist/dt/kerox/fcm.svg?style=for-the-badge" alt="Downloads">
16+
</a>
17+
<a href="https://packagist.org/packages/kerox/fcm" title="Latest Stable Version">
18+
<img src="https://img.shields.io/packagist/v/kerox/fcm.svg?style=for-the-badge" alt="Latest Stable Version">
19+
</a>
20+
<a href="https://packagist.org/packages/kerox/fcm" title="License">
21+
<img src="https://img.shields.io/packagist/l/kerox/fcm.svg?style=for-the-badge" alt="License">
22+
</a>
23+
</div>
24+
25+
# Fcm
1026

1127
A PHP libray to send push notification with [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/)
1228

13-
> Note: This is a portage as a standalone library, with some enhancements, of the great plugin [Laravel-FCM](https://github.com/brozot/Laravel-FCM) by [Nicolas Brosy](https://github.com/brozot)
14-
15-
## Requirements
29+
## Warning
1630

17-
* PHP >= 7.0
31+
Version `2.x` of this library is a full rewrite to be compliant with [HTTP v1 API](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages). If you are on Legacy HTTP API, then you should consider using version `1.x`
1832

19-
## Documentation
33+
## Installation
2034

21-
The documentation is available [here](http://fcm.readthedocs.org/en/latest/)
35+
You can install Fcm using Composer:
2236

23-
## License
37+
```
38+
composer require kerox/fcm
39+
```
2440

25-
The MIT License (MIT)
41+
You will then need to:
42+
* run `composer install` to get these dependencies added to your vendor directory
43+
* add the autoloader to your application with this line: `require('vendor/autoload.php');`
2644

27-
Copyright (c) 2016 Romain Monteil
2845

29-
Permission is hereby granted, free of charge, to any person obtaining a copy
30-
of this software and associated documentation files (the "Software"), to deal
31-
in the Software without restriction, including without limitation the rights
32-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33-
copies of the Software, and to permit persons to whom the Software is
34-
furnished to do so, subject to the following conditions:
35-
36-
The above copyright notice and this permission notice shall be included in all
37-
copies or substantial portions of the Software.
46+
## Documentation
3847

39-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45-
SOFTWARE.
48+
The documentation is available [here](http://fcm.readthedocs.org/en/latest/)

composer.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@
22
"name": "kerox/fcm",
33
"type": "library",
44
"description": "A PHP library to send push notification through Firebase Cloud Messaging",
5-
"keywords": ["fcm", "push", "notification", "firebase cloud messaging"],
5+
"keywords": [
6+
"fcm",
7+
"push",
8+
"notification",
9+
"firebase cloud messaging"
10+
],
611
"homepage": "https://github.com/ker0x/fcm",
712
"license": "MIT",
813
"authors": [
914
{
1015
"name": "Romain Monteil",
11-
"homepage": "http://kerox.fr",
16+
"homepage": "https://kerox.fr",
1217
"email": "monteil.romain@gmail.com",
1318
"role": "Author"
1419
}
1520
],
1621
"require": {
17-
"php": ">=7.0",
22+
"php": ">=7.1.0",
23+
"ext-json": "*",
1824
"guzzlehttp/guzzle": "^6.2"
1925
},
2026
"require-dev": {
21-
"phpunit/phpunit": "^5.5",
22-
"satooshi/php-coveralls": "^1.0",
23-
"squizlabs/php_codesniffer": "^2.7"
27+
"phpunit/phpunit": "^6.2.0",
28+
"squizlabs/php_codesniffer": "^3.0",
29+
"friendsofphp/php-cs-fixer": "^2.5",
30+
"codacy/coverage": "^1.4"
2431
},
2532
"autoload": {
2633
"psr-4": {
@@ -31,5 +38,13 @@
3138
"psr-4": {
3239
"Kerox\\Fcm\\Test\\": "tests"
3340
}
41+
},
42+
"scripts": {
43+
"test": "phpunit",
44+
"csfix": "php-cs-fixer fix --diff --verbose --config=.php_cs"
45+
},
46+
"config": {
47+
"optimize-autoloader": true,
48+
"sort-packages": true
3449
}
3550
}

0 commit comments

Comments
 (0)