greedchikara/onesignal

This is a wrapper for One Signal php apis

dev-master / 1.0.x-dev 2016-06-21 18:24 UTC

This package is auto-updated.

Last update: 2024-04-06 07:29:21 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

A service provider for Onesignal API in Laravel 5

Install

Via Composer

$ composer require greedchikara/onesignal dev-master

or append your composer.json with:

"require": {
    "greedchikara/onesignal": "dev-master"
},

Add the following settings to the config/app.php

Update Service Provider

'providers' => [
    ...
    'greedchikara\Onesignal\OnesignalServiceProvider',
]

Update Facade

'aliases' => [
    ...
    'Onesignal' => 'greedchikara\Onesignal\Facades\Onesignal',
]

Configuration

 php artisan vendor:publish --provider="greedchikara\Onesignal\OneSignalServiceProvider"

It will create onesignal.php within the config directory.

<?php

return [
    
    /*
    |--------------------------------------------------------------------------
    | OneSignal User Auth Key
    |--------------------------------------------------------------------------
    |
    | This value is used for making api call to onesignal server.
    | This is a compuslory value for making onesignal api calls.
    | Set this in your ".env" file.
    | Api's which utilizes this key
    |  - Server REST API - GET /apps (View Apps)
    |  - Server REST API - GET /apps/:id (View an app)
    |
    */
   
    'user_auth_key'  => env('ONESIGNAL_USER_AUTH_KEY'),

    /*
    |--------------------------------------------------------------------------
    | OneSignal First App
    |--------------------------------------------------------------------------
    |
    | Default name of first app
    | Do not change the key, however you can change the value.
    | But if you decide to change the value do update the procedding key.
    |
    */
    'first_app_name' => 'one_signal_mobile_push',

    // Config of the first App
    'one_signal_mobile_push' => [

        /*
        |--------------------------------------------------------------------------
        | One Signal App Id
        |--------------------------------------------------------------------------
        |
        | This value is used for making api call to one signal server.
        | This is a compuslory value for making onesignal api calls.
        | Set this in your ".env" file.
        |
        */
       
        'app_id' => env('FIRST_APP_ONESIGNAL_APP_ID'),

        /*
        |--------------------------------------------------------------------------
        | One Signal REST API Key
        |--------------------------------------------------------------------------
        |
        | This value is used for making api call to one signal server.
        | This is a compuslory value for making onesignal api calls.
        | Set this in your ".env" file.
        |
        */
        
        'rest_api_key' => env('FIRST_APP_ONESIGNAL_REST_API_KEY'),
    ],

    /*
    |--------------------------------------------------------------------------
    | OneSignal API Links
    |--------------------------------------------------------------------------
    |
    | Only update if Onesignal Updates it's API URL
    |
    */
    'view_apps'          => 'https://onesignal.com/api/v1/apps',
 
    'view_devices'       => 'https://onesignal.com/api/v1/players',

    'view_notifications' => 'https://onesignal.com/api/v1/notifications',

];

Usage

use Onesignal;
Onesignal::viewApps();

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Todo

  • Better documentation - in progress as you can see :)
  • Implementing the rest of the API. :)

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email negiakash@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.