genkgo / push
Send push messages to Android and Apple using one interface.
Installs: 25 839
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 5
Forks: 3
Open Issues: 0
Requires
- php: ~8.3.0 || ~8.4.0
- ext-json: *
- apple/apn-push: ^v3.1.7
- lcobucci/jwt: ^4.1.4 || ^5.5.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^v3.68.5
- guzzlehttp/guzzle: ^7.9.2
- phpstan/phpstan: ^2.1.4
- phpunit/phpunit: ^11.5.7
- dev-master
- 4.0.0
- 3.6.0
- 3.5.0
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.0.0
- 0.4.1
- 0.4.0
- 0.3.0
- 0.2.1
- 0.2.0
- 0.1.0
- dev-upgrade_81
- dev-support_php_8_0
- dev-upgrade_guzzle
- dev-convert_apple_exception
- dev-fix_too_many_provider_token_updates
- dev-catch_not_found
- dev-upgrade
This package is auto-updated.
Last update: 2025-02-11 12:58:33 UTC
README
Send push messages to Android, Apple and Firebase using one interface
Installation
Requires a PHP version getting security updates. It is installable and autoloadable via Composer as genkgo/push.
Quality
To run the unit tests at the command line, issue phpunit -c tests/
. PHPUnit is required.
This library attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.
Send Push Messages
<?php use Genkgo\Push\Body; use Genkgo\Push\Firebase\CloudMessaging; use Genkgo\Push\Gateway; use Genkgo\Push\Message; use Genkgo\Push\Sender\FirebaseSender; use Genkgo\Push\Sender\AppleApnSender; use Genkgo\Push\Recipient\AndroidDeviceRecipient; use Genkgo\Push\Recipient\AppleDeviceRecipient; use Genkgo\Push\Recipient\FirebaseRecipient; // construct the gateway, using the different senders $gateway = new Gateway([ AppleApnSender::fromToken('/location/to/key.p8', 'keyId', 'teamId', 'bundleId'), new FirebaseSender(new CloudMessaging($guzzleClient, $auth), 'fcm-project-id') ]); // below message will automatically go to their own specific sender $gateway->send(new Message(new Body('message content')), new AndroidDeviceRecipient('token')); $gateway->send(new Message(new Body('message content')), new AppleDeviceRecipient('token')); $gateway->send(new Message(new Body('message content')), new FirebaseRecipient('token'));
Contributing
- Found a bug? Please try to solve it yourself first and issue a pull request. If you are not able to fix it, at least give a clear description what goes wrong. We will have a look when there is time.
- Want to see a feature added, issue a pull request and see what happens. You could also file a bug of the missing feature and we can discuss how to implement it.