paliari/php-push-notification

0.1.0 2017-11-15 02:45 UTC

This package is auto-updated.

Last update: 2024-04-17 08:35:14 UTC


README

Installation

$ composer require paliari/php-push-notification

Usage

Initialize with your credentials

use Paliari\PushFacade;
$configs = [
 'one_signal' => [
   '<yor app name>' => [
     'app_id'       => '<yor app_id>',
     'rest_api_key' => '<yor rest_api_key>',
   ],
   '<yor app name 2>' => [
     'app_id'       => '<yor app_id 2>',
     'rest_api_key' => '<yor rest_api_key 2>',
   ],
 ],
 'expo'       => [...],
];

PushFacade::setUp($configs);

Send notifications from anywhere in your application

use Paliari\PushFacade;

$tokens = ['<token_01>', '<token_02>','<token_n>'];
$extra_params = [
  'title' => '<your title message>', // optional
  'url' => 'http://website.com', // optional for web
  'data' => [
    '<your custom param>' => '<your custom value>',
    // ... any ...
  ],
]; 
$provider = PushFacade::ONE_SIGNAL;
$app_name = '<your-app-name>';
$message = '<your message content.>';
PushFacade::provider($provider, $app_name)->send($message, $tokens, $extra_params);

See

Authors

License

This project is licensed under MIT License