PHP Classes

YII2 notymo: Send iOS and Android push notifications

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 123 All time: 9,471 This week: 524Up
Version License PHP version Categories
yii2-notymo 1.0.0Custom (specified...5PHP 5, Wireless and Mobile, Web services
Description 

Author

This package can be used to send iOS and Android push notifications.

It can take a list of user identifiers and send push notifications to the respective devices using the Android or Apple push notifications Web services.

The package can pull the device identifiers from a data source that can be a MongoDB database or a SQL database using the YII framework packages.

Picture of Edgar Asatryan
Name: Edgar Asatryan <contact>
Classes: 4 packages by
Country: Armenia Armenia
Age: ???
All time rank: 29777 in Armenia Armenia
Week rank: 136 Up1 in Armenia Armenia Up
Innovation award
Innovation award
Nominee: 1x

Documentation

yii2-notymo Build Status Scrutinizer Code Quality Code Coverage

The iOS and Android push notification extension for Yii2.

Installation

The suggested installation method is via composer:

$ composer require nstdio/yii2-notymo: "dev-master"

or add

"nstdio/yii2-notymo": "dev-master"

to the require section of your composer.json file.

Usage

Defining as application component

// web.php or console.php
'component' => [
    
    // ...
    
    'notymo'  => [
        'class'        => 'nstdio\yii2notymo\PushNotification',
        'push'         => [
            // If you d?n't want to use one of the services we can just skip them loading.
            // It's obvious that the skipped service is not necessary to configure.
            // 'skipApns' => true,
            // 'skipGcm'  => true,
            'apns' => [
                'live'        => true, // Whether to use live credentials.
                'cert'        => 'path/to/apns_live_cert.pem',
                'sandboxCert' => 'path/to/apns_sandbox_cert.pem',
            ],
            'gcm'  => [
                'apiKey' => 'api_key' // Here goes GCM Service API key. 
            ],
        ],
        'dataProvider' => [
            'class'      => 'nstdio\yii2notymo\provider\SQLDataProvider',
            'table'      => 'device_token', // The table from which the data will be obtained.
            'identifier' => 'user_id', // The identifier that defines the criteria for what data will be obtained. In this case, it is the column name from the table.
            'apns'       => 'apns_token', // The column name for APNS device tokens.
            'gcm'        => 'gcm_token', // The column name for GCM device tokens.
        ],
    ],
],

// For example SiteController.php
use nstdio\notymo\Message;
// ...

$userIds = [1, 2, 3, 4, 5];

/ @var \nstdio\yii2notymo\PushNotification $push */
$push = Yii::$app->notymo;

$msg = new Message();
$msg->setMessage("Test msg.");

$push->send($msg, $userIds); // Message will be sent to mentioned users.

  Files folder image Files (20)  
File Role Description
Files folder image.idea (1 file)
Files folder imageprovider (3 files)
Files folder imagetests (3 files, 3 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file mongodb-setup.sh Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Plain text file PushNotification.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (20)  /  .idea  
File Role Description
  Accessible without login Plain text file vcs.xml Data Auxiliary data

  Files folder image Files (20)  /  provider  
File Role Description
  Plain text file DataProvider.php Class Class source
  Plain text file MongoDataProvider.php Class Class source
  Plain text file SQLDataProvider.php Class Class source

  Files folder image Files (20)  /  tests  
File Role Description
Files folder imageconfig (2 files)
Files folder imagefixtures (1 file, 1 directory)
Files folder imagemigrations (1 file)
  Accessible without login Plain text file bootstrap.php Aux. Auxiliary script
  Plain text file SQLDataProviderTest.php Class Class source
  Plain text file TestCase.php Class Class source

  Files folder image Files (20)  /  tests  /  config  
File Role Description
  Accessible without login Plain text file db.php Aux. Auxiliary script
  Accessible without login Plain text file params.php Aux. Auxiliary script

  Files folder image Files (20)  /  tests  /  fixtures  
File Role Description
Files folder imagedata (1 file)
  Plain text file DeviceTokenFixture.php Class Class source

  Files folder image Files (20)  /  tests  /  fixtures  /  data  
File Role Description
  Accessible without login Plain text file device_token.php Aux. Auxiliary script

  Files folder image Files (20)  /  tests  /  migrations  
File Role Description
  Plain text file m161002_171521_cre...ice_token_table.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:123
This week:0
All time:9,471
This week:524Up