superbalist/laravel-localytics-push

This package is abandoned and no longer maintained. No replacement package was suggested.

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

1.0.0 2016-10-19 08:45 UTC

This package is auto-updated.

Last update: 2022-07-13 19:08:17 UTC


README

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);