Superbalist / laravel-localytics-push by superbalist

A Laravel library for sending push notifications via the Localytics Push Notification service
60
0
35
Package Data
Maintainer Username: superbalist
Maintainer Contact: info@superbalist.com (Superbalist.com a division of Takealot Online (Pty) Ltd)
Package Create Date: 2016-10-19
Package Last Update: 2017-02-06
Language: PHP
License: MIT
Last Refreshed: 2020-10-15 03:31:29
Package Statistics
Total Downloads: 60
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 35
Total Forks: 0
Total Open Issues: 0

laravel-localytics-push

A Laravel library for sending push notifications via the Localytics Push Notification service

Author Build Status StyleCI Software License Packagist Version Total Downloads

This package is a wrapper bridging php-localytics-push into Laravel.

Installation

composer require superbalist/laravel-localytics-push

The package has a default configuration which uses the following environment variables.

LOCALYTICS_APP_ID=null
LOCALYTICS_API_KEY=null
LOCALYTICS_API_SECRET=null

To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish --provider="Superbalist\LaravelLocalyticsPush\LocalyticsServiceProvider"

You can then edit the generated config at app/config/localytics.php.

Register the service provider in app.php

'providers' => [
    // ...
    Superbalist\LaravelLocalyticsPush\LocalyticsServiceProvider::class,
]

Register the facade in app.php

'aliases' => [
    // ...
    'Localytics' => Superbalist\LaravelLocalyticsPush\LocalyticsFacade::class,
]

Usage

$message = [
    'target' => [
        'profile' => [
            'criteria' => [
                [
                    'key' => '$email',
                    'scope' => 'Organization',
                    'type' => 'string',
                    'op' => 'in',
                    'values' => [
                        'matthew@superbalist.com',
                    ]
                ]
            ],
            'op' => 'and',
        ],
    ],
    'alert' => [
        'title' => 'Message Title',
        'body' => 'This is my message content!',
    ]
];
Localytics::pushMessage('profile', $message);