Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #70

Closed
wants to merge 122 commits into from
Closed

test #70

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
501272f
Merge pull request #7 from utopia-php/feat-base
eldadfux Sep 29, 2022
0b325bc
remove authors
mohith2883 Oct 27, 2022
599866b
Resolved changes
mohith2883 Oct 29, 2022
8387f7f
Issue-4358: Add Code Linter To utopia-php/messaging
Rutam21 Oct 30, 2022
6e5dbb9
Move send function up to base adapter
abnegate Dec 7, 2022
72fc8b6
Add discord adapter
abnegate Dec 7, 2022
887590e
Merge pull request #10 from mohith2883/remove_authors
christyjacob4 Dec 20, 2022
3a0d6b9
Merge pull request #11 from Rutam21/APPW-4358
christyjacob4 Dec 20, 2022
2cf800f
Fix adapters using application/xxx-form-urlencoded content type
abnegate Jan 26, 2023
0443e4c
Format
abnegate Jan 26, 2023
33da81d
Implement Telnyx SMS adapter
dcowan-london Jan 26, 2023
70d937c
remove base64_encode Telnyx apikey
dcowan-london Jan 26, 2023
d238169
add trailing comma
dcowan-london Jan 26, 2023
05c0f0d
Update PHPDoc Telnyx api key param
dcowan-london Jan 27, 2023
15924c0
Avoid strlen null param warning
abnegate Feb 2, 2023
0e5e9ba
Format
abnegate Feb 3, 2023
a75d66d
Merge pull request #12 from utopia-php/fix-xxx-form-urlencoded
abnegate Feb 7, 2023
5fdf678
Merge pull request #14 from dcowan-london/feat-13-telnyx-messaging-ad…
abnegate Feb 8, 2023
5170f3c
Add Plivo SMS adapter
byawitz Mar 29, 2023
5aeadaf
Add Clickatell SMS adapter
byawitz Mar 29, 2023
72ae558
Add Infobip SMS adapter
byawitz Mar 29, 2023
86d1771
Add Sinch SMS adapter
byawitz Mar 29, 2023
a1ff7b7
Add Sinch SMS adapter
byawitz Mar 29, 2023
83dd057
Add Seven (Formally sms77) SMS adapter
byawitz Mar 29, 2023
1444cc1
Implemented providers pricing compare table
byawitz Mar 29, 2023
a064626
Fixing small miss priced rows
byawitz Mar 29, 2023
2c75453
Update documentation link
byawitz Mar 29, 2023
2b69b48
Update sms pricing to be sorted by price
byawitz Mar 30, 2023
43cc006
Formatting & linting
byawitz Apr 3, 2023
0f4033a
[Correct] Formatting & linting
byawitz May 31, 2023
0aef44f
Verify max messages
byawitz May 31, 2023
52021ee
Added start to APNS
wess Jul 19, 2023
8ee1844
Data structures and apns
wess Jul 29, 2023
2e37e48
working on email adapter for service and impl
wess Jul 31, 2023
5ccda37
Little reorg
wess Jul 31, 2023
e9c792a
Sendgrid test and some key clean up
wess Aug 2, 2023
cb8f99e
Removes unneeded classes for apns
wess Aug 3, 2023
f0c5cbb
Removes TwilioNotify as Twilio is ending it this year
wess Aug 4, 2023
6472702
Twillio test
wess Aug 4, 2023
40eada3
Removes, decided, unneeded entities
wess Aug 7, 2023
43bed4b
Updates gitignore, it was missing a good bit
wess Aug 11, 2023
7f4448c
Moves p8 to use env var
wess Aug 11, 2023
5d26fde
Adds proper env vars to docker-compose.yml
wess Aug 14, 2023
0ea850d
lint all the things! (^_^)/
wess Aug 14, 2023
6f2defb
Let's add EU
wess Aug 14, 2023
5f85757
Fixes lints and boom passing tests
wess Aug 14, 2023
b8add14
PR requested updates
wess Aug 30, 2023
da94fa7
Correction and clean up for APNS.php
wess Aug 30, 2023
d43325a
Removes personal email and moves test emails into .env
wess Aug 30, 2023
36aee6a
Lint fixes
wess Aug 30, 2023
ab0a41c
Removes .env from docker compose
wess Aug 31, 2023
4ebebe9
Adds US flag to mailgun for region handling
wess Sep 1, 2023
a1a1fb3
Forwards env files in docker-composer.yml
wess Sep 7, 2023
1c5a451
Updates workflow for runtime env vars
wess Sep 7, 2023
8f0e760
isUS, for mailgun, is true
wess Sep 7, 2023
b301211
Type-o in workflow
wess Sep 7, 2023
5e5e063
Removes dead commented code
wess Sep 8, 2023
3da89f1
Updates requested for PR
wess Sep 8, 2023
b67db70
Updates sendgrid to check for empty/success response
wess Sep 11, 2023
abb795f
LINT run.
wess Sep 11, 2023
91885b0
Updates docker compose with vonage vars
wess Sep 11, 2023
5114e74
Adds FCM key to env
wess Sep 11, 2023
ee8c94c
Adds vars to test workflow
wess Sep 11, 2023
a627f56
removed extra character in yml
wess Sep 11, 2023
2d7001f
Restart job
wess Sep 11, 2023
436fbf5
testing with inline value
wess Sep 11, 2023
a9e9000
Adds FCM_SERVER_TO back in to ENV
wess Sep 11, 2023
6367acc
Lint and changes
wess Sep 11, 2023
fcde4b4
APNS max send bumped to 5k
wess Sep 11, 2023
2bb0922
Uses curl_multi for apple push
wess Sep 14, 2023
a14b8ac
Merge pull request #20 from utopia-php/feat-push
abnegate Sep 14, 2023
2d0f474
Merge pull request #16 from byawitz/feat-adding-sms-adapters
abnegate Sep 14, 2023
ef2caf9
Fixes issue with to grouping
wess Oct 24, 2023
0ee2ebe
Fixing Msg91 delivery
wess Oct 25, 2023
ae5aed1
Updates $to for Msg91 recipents
wess Oct 25, 2023
9f47235
Merge remote-tracking branch 'origin/main' into feat-external-adapters
abnegate Oct 31, 2023
9be0501
Update workflows
abnegate Nov 1, 2023
b24deb9
Add discord test
abnegate Nov 1, 2023
aa635f1
Add discord keys to workflow
abnegate Nov 1, 2023
327acfd
Lint
abnegate Nov 2, 2023
1060cc1
Fix test config
abnegate Nov 2, 2023
983914c
feat: geosms adapter
loks0n Nov 7, 2023
1284c5b
test: enable msg91
loks0n Nov 7, 2023
a9e2d22
chore: fmt
loks0n Nov 7, 2023
1c6b1c7
fix: geosms namespace
loks0n Nov 7, 2023
83641f1
chore: fmt
loks0n Nov 7, 2023
fe65ede
fix: geosms mock
loks0n Nov 7, 2023
f212fc8
fix: geosms remove +
loks0n Nov 7, 2023
e199d58
feat: return lowest of adapters for getMaxMessagesPerRequest
loks0n Nov 7, 2023
cb5ffea
feat: extract calling code
loks0n Nov 8, 2023
13eaea3
chore: rename na code
loks0n Nov 8, 2023
33ccaef
chore: fmt
loks0n Nov 8, 2023
6e2dbcb
feat: use fields instead of enum
loks0n Nov 8, 2023
47b6122
feat: exception handling
loks0n Nov 8, 2023
5e2f0a2
test: msg91
loks0n Nov 8, 2023
67da6a3
chore: update tests
christyjacob4 Nov 8, 2023
4ee2814
chore: remove checks for message assertion
christyjacob4 Nov 8, 2023
b5b64c3
Formatting
wess Nov 9, 2023
faf88d1
feat: group by adapter
loks0n Nov 9, 2023
537aab3
chore: revert msg91
loks0n Nov 9, 2023
c40274d
fix: msg91 payload
loks0n Nov 9, 2023
fd88522
test: fix msg91
loks0n Nov 9, 2023
fee654e
feat: add otp variable
loks0n Nov 9, 2023
28f0599
Refactor `App` namespace to `Chat`
abnegate Nov 9, 2023
8ba50f7
Merge pull request #64 from utopia-php/feat-geosms-adapter
abnegate Nov 10, 2023
a7bcbe5
Merge remote-tracking branch 'origin/main' into feat-app-adapters
abnegate Nov 10, 2023
ce08abb
Stan fixes
abnegate Nov 10, 2023
d38ab4a
Lint
abnegate Nov 10, 2023
40e2484
Test downgrade PHPUnit
abnegate Nov 10, 2023
f95544b
Merge branch 'main' of https://github.com/utopia-php/messaging into f…
loks0n Nov 10, 2023
d327e23
feat: trim + from msg91 numbers
loks0n Nov 10, 2023
b4d3704
Update src/Utopia/Messaging/Adapters/SMS/Msg91.php
abnegate Nov 14, 2023
d488223
Merge pull request #65 from utopia-php/fixes-msg91
abnegate Nov 14, 2023
b0a314f
feat: add sms from override to constructor
loks0n Nov 20, 2023
96a3caf
Merge pull request #66 from utopia-php/feat-sms-from
abnegate Nov 20, 2023
7223f34
Use default false bool sandbox instead of endpoint param
abnegate Nov 21, 2023
4ba7e30
Add https scheme
abnegate Nov 21, 2023
8e49773
Format
abnegate Nov 21, 2023
72faf59
Fix missing base imports
abnegate Nov 21, 2023
fb2a096
Merge pull request #67 from utopia-php/chore-remove-apns-endpoint
abnegate Nov 27, 2023
996cc78
Merge remote-tracking branch 'origin/main' into feat-app-adapters
abnegate Nov 27, 2023
d23a334
Merge pull request #63 from utopia-php/feat-app-adapters
abnegate Nov 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Static Analysis"

on: [pull_request]
jobs:
analyse:
name: Analyse
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2

- name: Run Static Analysis
run: |
docker run --rm -v $PWD:/app composer sh -c \
"composer install --profile --ignore-platform-reqs && composer analyse"
2 changes: 2 additions & 0 deletions .github/workflows/linter.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 2

- run: git checkout HEAD^2

- name: Run Linter
run: |
docker run --rm -v $PWD:/app composer sh -c \
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Tests"

on: [pull_request]
jobs:
tests:
name: Unit & E2E
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2
- run: git checkout HEAD^2
- name: Run Tests
env:
MAILGUN_API_KEY: ${{ secrets.MAILGUN_API_KEY }}
MAILGUN_DOMAIN: ${{ secrets.MAILGUN_DOMAIN }}
SENDGRID_API_KEY: ${{ secrets.SENDGRID_API_KEY }}
FCM_SERVER_KEY: ${{ secrets.FCM_SERVER_KEY }}
FCM_SERVER_TO: ${{ secrets.FCM_SERVER_TO }}
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
TWILIO_TO: ${{ secrets.TWILIO_TO }}
TWILIO_FROM: ${{ secrets.TWILIO_FROM }}
TELNYX_API_KEY: ${{ secrets.TELNYX_API_KEY }}
TELNYX_PUBLIC_KEY: ${{ secrets.TELNYX_PUBLIC_KEY }}
APNS_AUTHKEY_8KVVCLA3HL: ${{ secrets.APNS_AUTHKEY_8KVVCLA3HL }}
APNS_AUTH_ID: ${{ secrets.APNS_AUTH_ID }}
APNS_TEAM_ID: ${{ secrets.APNS_TEAM_ID }}
APNS_BUNDLE_ID: ${{ secrets.APNS_BUNDLE_ID }}
APNS_TO: ${{ secrets.APNS_TO }}
MSG_91_SENDER_ID: ${{ secrets.MSG_91_SENDER_ID }}
MSG_91_AUTH_KEY: ${{ secrets.MSG_91_AUTH_KEY }}
MSG_91_TO: ${{ secrets.MSG_91_TO }}
MSG_91_FROM: ${{ secrets.MSG_91_FROM }}
TEST_EMAIL: ${{ secrets.TEST_EMAIL }}
TEST_FROM_EMAIL: ${{ secrets.TEST_FROM_EMAIL }}
VONAGE_API_KEY: ${{ secrets.VONAGE_API_KEY }}
VONAGE_API_SECRET: ${{ secrets.VONAGE_API_SECRET }}
VONAGE_TO: ${{ secrets.VONAGE_TO }}
VONAGE_FROM: ${{ secrets.VONAGE_FROM }}
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
run: |
docker compose up -d --build
sleep 5
docker compose exec tests vendor/bin/phpunit
19 changes: 0 additions & 19 deletions .github/workflows/tests.yml

This file was deleted.

94 changes: 94 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,97 @@
.idea
vendor
Makefile
.envrc
.env
*.p8

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### PHPUnit ###
# Covers PHPUnit
# Reference: https://phpunit.de/

# Generated files
.phpunit.result.cache
.phpunit.cache

# PHPUnit
/app/phpunit.xml
/phpunit.xml

# Build data
/build/

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/macos,linux,windows,phpunit
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ Install using composer:
composer require utopia-php/messaging
```

## Email
## Email

```php
<?php

use \Utopia\Messaging\Messages\Email;
use \Utopia\Messaging\Adapters\Email\SendGrid;
use \Utopia\Messaging\Adapters\Email\Mailgun;
use \Utopia\Messaging\Adapter\Email\SendGrid;
use \Utopia\Messaging\Adapter\Email\Mailgun;

$message = new Email(
to: ['team@appwrite.io'],
Expand All @@ -43,8 +43,8 @@ $messaging->send($message);
<?php

use \Utopia\Messaging\Messages\SMS;
use \Utopia\Messaging\Adapters\SMS\Twilio;
use \Utopia\Messaging\Adapters\SMS\Telesign;
use \Utopia\Messaging\Adapter\SMS\Twilio;
use \Utopia\Messaging\Adapter\SMS\Telesign;

$message = new SMS(
to: ['+12025550139'],
Expand All @@ -64,7 +64,7 @@ $messaging->send($message);
<?php

use \Utopia\Messaging\Messages\Push;
use \Utopia\Messaging\Adapters\Push\FCM;
use \Utopia\Messaging\Adapter\Push\FCM;

$message = new Push(
to: ['eyJhGc...ssw5c'],
Expand Down Expand Up @@ -98,12 +98,12 @@ $messaging->send($message);
- [x] [TextMagic](https://www.textmagic.com/)
- [x] [Msg91](https://msg91.com/)
- [x] [Vonage](https://www.vonage.com/)
- [ ] [Plivo](https://www.plivo.com/)
- [ ] [Infobip](https://www.infobip.com/)
- [ ] [Clickatell](https://www.clickatell.com/)
- [x] [Plivo](https://www.plivo.com/)
- [x] [Infobip](https://www.infobip.com/)
- [x] [Clickatell](https://www.clickatell.com/)
- [ ] [AfricasTalking](https://africastalking.com/)
- [ ] [Sinch](https://www.sinch.com/)
- [ ] [Sms77](https://www.sms77.io/)
- [x] [Sinch](https://www.sinch.com/)
- [x] [Seven](https://www.seven.io/)
- [ ] [SmsGlobal](https://www.smsglobal.com/)

### Push
Expand Down Expand Up @@ -135,13 +135,6 @@ To run static code analysis, use the following Psalm command:
composer lint
```

## Authors

**Jake Barnby**

+ [https://github.com/abnegate](https://github.com/abnegate)
+ [https://nz.linkedin.com/in/jakebarnby](https://nz.linkedin.com/in/jakebarnby)

## Copyright and license

The MIT License (MIT) [http://www.opensource.org/licenses/mit-license.php](http://www.opensource.org/licenses/mit-license.php)
24 changes: 10 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,31 @@
"license": "MIT",
"minimum-stability": "stable",
"scripts": {
"test": "vendor/bin/phpunit",
"lint": "vendor/bin/phpcs",
"format": "vendor/bin/phpcbf"
"test": "./vendor/bin/phpunit",
"lint": "./vendor/bin/pint --test",
"format": "./vendor/bin/pint",
"analyse": "./vendor/bin/phpstan analyse --memory-limit=2G --level=6 src tests"
},
"authors": [
{
"name": "Jake Barnby",
"email": "jake@appwrite.io"
}
],
"autoload": {
"psr-4": {
"Utopia\\Messaging\\": "src/Utopia/Messaging"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\E2E\\": "tests/e2e",
"Tests\\Unit\\": "tests/unit"
"Utopia\\Tests\\": "tests/Messaging"
}
},
"require": {
"php": ">=8.0.0",
"ext-curl": "*"
},
"require-dev": {
"phpunit/phpunit": "9.5.*",
"phpmailer/phpmailer": "6.6.*",
"squizlabs/php_codesniffer": "^3.6"
"ext-openssl": "*",
"phpunit/phpunit": "9.6.10",
"phpmailer/phpmailer": "6.8.*",
"laravel/pint": "1.13.*",
"phpstan/phpstan": "1.10.*"
},
"config": {
"platform": {
Expand Down
Loading
Loading