├── .github
└── FUNDING.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── _config.yml
├── composer.json
├── config
└── one-signal.php
├── src
├── OneSignal.php
├── OneSignalClient.php
├── OneSignalManager.php
├── OneSignalServiceProvider.php
├── commands
│ └── PublishUserDevice.php
└── stubs
│ ├── CreateUserDeviceTable.stub
│ ├── UserDevice.stub
│ ├── UserDeviceAPIController.stub
│ └── UserDeviceRepository.stub
└── v1.0.0-guide.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: https://www.buymeacoffee.com/ladumor
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | .env.*.php
3 | .env.php
4 | .env
5 | .idea
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### [v2.0.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v2.0.0) (Jan 13, 2025)
2 | #### Added
3 | * One Signal API Latest version support add
4 | * New APIs Support added
5 | * Live Activities
6 | * User
7 | * Subscriptions
8 | * Templates
9 | * Laravel 11 support add
10 | * User devices new fields added as per user modal
11 | * Laravel 7 and below support removed (use version 1.0.0 this versions)
12 | * Deperecated api support removed
13 | * Devices
14 |
15 | ### [v1.0.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v1.0.0) (Jun 22, 2023)
16 | #### Added
17 | * Laravel 10 support add
18 |
19 | ### [v0.4.4](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.4.4) (Feb 1, 2023)
20 | #### Added
21 | * add [View Outcomes](https://documentation.onesignal.com/reference/view-outcomes) support
22 |
23 | ### [v0.4.3](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.4.3) (Feb 27, 2022)
24 |
25 | #### Fixed
26 | * fixed bug: The migration is thrown error (Laravel 8.83.23) : PHP Fatal error: Cannot declare class CreateUserDevicesTable, [(#21)](https://github.com/shailesh-ladumor/one-signal/pull/21)
27 |
28 | ### [v0.4.2](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.4.2) (Feb 27, 2022)
29 |
30 | #### Added
31 | * Laravel 9 support add
32 | * Delete Device Support Add
33 |
34 | ### [v0.4.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.4.0) (Jun 21, 2021)
35 |
36 | #### Added
37 | * Add User Device Mobile API support [(#12)](https://github.com/shailesh-ladumor/one-signal/pull/12) [(#7a3243d)](https://github.com/shailesh-ladumor/one-signal/commit/7a3243d30ab64e05fed5edea22386a3ea3a6ff74)
38 | * Readme updated
39 |
40 | ### [v0.3.4](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.3.4) (Dec 25, 2020)
41 |
42 | ##### Changed
43 | * Laravel v8.x Support add [(#8)](https://github.com/shailesh-ladumor/one-signal/pull/8) [(ef044f)](https://github.com/shailesh-ladumor/one-signal/pull/8/commits/42e34111340519ebf9104ea0f5a3c49892ef044f)
44 | * fixed issue [#7](https://github.com/shailesh-ladumor/one-signal/issues/7)
45 |
46 | ### [v0.3.3](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.3.3) (July 18, 2020)
47 |
48 | ##### Changed
49 | * Fix the update App API and moved config vars into client [(#6)](https://github.com/shailesh-ladumor/one-signal/pull/6) [(98647a3)](https://github.com/shailesh-ladumor/one-signal/pull/6/commits/98647a35d7b69d8f63adad803278a85f8244b6ed)
50 | * Readme updated
51 |
52 | ### [v0.3.2](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.3.2) (May 10, 2020)
53 |
54 | ##### Added
55 | * Segments support add [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/5) [(988e474)](https://github.com/shailesh-ladumor/one-signal/commit/988e4741249a37d076c08ff902dadf84c399a77e)
56 | * Apps Support add [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/5) [(7660ac3)](https://github.com/shailesh-ladumor/one-signal/commit/7660ac39baa55d2eb60610ed50192a80d3e086ee)
57 | ##### Changed
58 | * Readme updated with `apps` and `segments` example [(#5)](https://github.com/shailesh-ladumor/one-signal/pull/5)
59 |
60 | ### [v0.3.1](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.3.1) (April 4th, 2020)
61 | ##### Changed
62 | * `Device` URl change [issue reported by @yusronMu77] [(#3)](https://github.com/shailesh-ladumor/one-signal/issues/3) [(0986551)](https://github.com/shailesh-ladumor/one-signal/commit/0986551481e395da25aef4f6895f63a0e0c4e914)
63 |
64 | ### [v0.3.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.3.0) (March 15th, 2020)
65 |
66 | ##### Added
67 | * `Laravel 7` support added [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2) [(cd3f347)](https://github.com/shailesh-ladumor/one-signal/pull/2/commits/cd3f347e4ee0cf1cd9101c2dae599713e9d650f7)
68 | * Retrieve all `devices` support added [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2) [(f947ea4)](https://github.com/shailesh-ladumor/one-signal/pull/2/commits/f947ea4bbe3dcf14aaefd0942eff07375e818c56#diff-21b615b0e4f9bb5208699be064b7d31bR174)
69 | * Retrieve single `device` support added [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2) [(f947ea4)](https://github.com/shailesh-ladumor/one-signal/pull/2/commits/f947ea4bbe3dcf14aaefd0942eff07375e818c56#diff-21b615b0e4f9bb5208699be064b7d31bR188)
70 | * Create `device` support added [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2) [(f947ea4)](https://github.com/shailesh-ladumor/one-signal/pull/2/commits/f947ea4bbe3dcf14aaefd0942eff07375e818c56#diff-21b615b0e4f9bb5208699be064b7d31bR202)
71 | * update `device` support added [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2) [(f947ea4)](https://github.com/shailesh-ladumor/one-signal/pull/2/commits/f947ea4bbe3dcf14aaefd0942eff07375e818c56#diff-21b615b0e4f9bb5208699be064b7d31bR223)
72 | ##### Changed
73 | * Readme updated with `devices` example [(#2)](https://github.com/shailesh-ladumor/one-signal/pull/2)
74 |
75 | ### [v0.2.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.2.0) (Feb 2nd, 2020)
76 |
77 | ##### Added
78 |
79 | * Retrieve all notifications support added [(#1)](https://github.com/shailesh-ladumor/one-signal/pull/1) [(6d54af9)](https://github.com/shailesh-ladumor/one-signal/pull/1/commits/6d54af94f134a541ddbc02f9c823097093fce72a)
80 | * Retrieve single notifications support added [(#1)](https://github.com/shailesh-ladumor/one-signal/pull/1) [(fbc593f)](https://github.com/shailesh-ladumor/one-signal/pull/1/commits/fbc593fd4aa2ff63d194d84bbe64c6ce1b86a27b)
81 | * Changelog added [(#1)](https://github.com/shailesh-ladumor/one-signal/pull/1) [(a189100)](https://github.com/shailesh-ladumor/one-signal/pull/1/commits/a189100566076e66459f5768affbaaa0c907421e)
82 | * notifications example added in readme [(#1)](https://github.com/shailesh-ladumor/one-signal/pull/1) [(46172de)](https://github.com/shailesh-ladumor/one-signal/pull/1/commits/46172deffa10fb973fdfb1ea074636a902eadfd8)
83 |
84 | #### Changed
85 | * Readme updated with contents [(#1)](https://github.com/shailesh-ladumor/one-signal/pull/1) [(1e877bd)](https://github.com/shailesh-ladumor/one-signal/pull/1/commits/1e877bdbe154eeb36c384c4aa4d3827d65764779)
86 |
87 | ### [v0.1.0](https://github.com/shailesh-ladumor/one-signal/releases/tag/v0.1.0) (Jan 31st, 2020)
88 |
89 | ##### Added
90 |
91 | * Send Push support added
92 | * Customize content support added
93 | * Readme - docs added
94 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Shailesh Ladumor
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Laravel One Signal
2 |
3 | Laravel One Signal is Laravel Wrapper for [One Signal](https://onesignal.com). One Signal is a great platform for send a
4 | push notification to your users. This package mentions in One Signal's official Document. you can
5 | see [here](https://documentation.onesignal.com/docs/other-cms-setup)
6 |
7 | [](https://packagist.org/packages/ladumor/one-signal)
8 | [](https://packagist.org/packages/ladumor/one-signal)
9 | [](https://packagist.org/packages/ladumor/one-signal)
10 | [](LICENSE.md)
11 |
12 | # Give a Star if this package realy usefull to you. it's free :laughing:
13 |
14 | ## :film_strip: here are video tutorials
15 |
16 | #### How to install and how to implement notifications and devices APIs.
17 |
18 | [
](https://youtu.be/c1W7unOw3s4)
19 |
20 | #### how to implement Segment and Apps APIs.
21 |
22 | [
](https://youtu.be/mxiEZ4H2cgY)
23 |
24 |
25 |
26 | ## Requirements.
27 |
28 | v2.0.0 is released with new features and new APIs with latest version of one signal. this version is supported in
29 | laravel 8 and more.
30 | if you want to use this package in laravel 7 or lower version than you can
31 | use [v1.0.0](https://github.com/shailesh-ladumor/one-signal/blob/master/v1.0.0-guide.md).
32 |
33 | ## Contents
34 |
35 | - [Installation](#installation)
36 | - [Publish the config file](#publish-the-config-file)
37 | - [Add Provider](#add-provider)
38 | - [Add Facade](#add-facade)
39 | - [Usage](#usage)
40 | - [Messages](#messages)
41 | - [Send Notification](#send-notification)
42 | - [push](#push)
43 | - [email](#email)
44 | - [sms](#sms)
45 | - [Customise Contents](#customise-contents)
46 | - [Get Single Notification](#get-single-notification)
47 | - [Get All Notifications](#get-all-notifications)
48 | - [Cancel Notification](#cancel-notification)
49 | - [Notification History](#notification-history)
50 | - [Live Activities](#live-activities)
51 | - [Start Live Activity](#start-live-activity)
52 | - [Update Live Activity](#update-live-activity)
53 | - [User](#user)
54 | - [Create User](#create-user)
55 | - [View User](#view-user)
56 | - [Update User](#update-user)
57 | - [Delete User](#delete-user)
58 | - [View User Identity](#view-user-identity)
59 | - [View User Identity By Sponsorship](#view-user-identity-by-sponsorship)
60 | - [Create Alias](#create-alias)
61 | - [Create Alias by subscription](#create-alias-by-subscription)
62 | - [Delete Alias](#delete-alias)
63 | - [Subscription](#subscription)
64 | - [Create Subscription](#create-subscription)
65 | - [Update Subscription](#update-subscription)
66 | - [Delete Subscription](#delete-subscription)
67 | - [Transfer Subscription](#transfer-subscription)
68 | - [Unsubscribe Notification](#unsubscribe-notification)
69 | - [Template](#template)
70 | - [Create Template](#create-template)
71 | - [Update Template](#update-template)
72 | - [View Template](#view-template)
73 | - [View Templates](#view-templates)
74 | - [Delete Template](#delete-template)
75 | - [Copy Template](#copy-template)
76 | - [Segment](#segment)
77 | - [Create Segment (NEED PAID PLAN)](#create-segment)
78 | - [Delete Segment (NEED PAID PLAN)](#delete-segment)
79 | - [Apps](#apps)
80 | - [View Apps](#view-apps)
81 | - [View App](#view-app)
82 | - [Create App](#create-app)
83 | - [Update App](#update-app)
84 | - [View Outcomes](#view-outcomes)
85 | - [User Device](#user-device)
86 | - [Change Log](#change-log)
87 | - [License](#license)
88 |
89 | ## Watch Other Lavavel tutorial here
90 |
91 | [
](https://www.youtube.com/channel/UCuCjzuwBqMqFdh0EU-UwQ-w?sub_confirmation=1))
92 |
93 | ## Installation
94 |
95 | Install the package by the following command
96 |
97 | composer require ladumor/one-signal:2.0.0
98 |
99 | ## Publish the config file
100 |
101 | Run the following command to publish config file,
102 |
103 | php artisan vendor:publish --provider="Ladumor\OneSignal\OneSignalServiceProvider"
104 |
105 | ## Add Provider
106 |
107 | Add the provider to your `config/app.php` into `provider` section if using lower version of laravel,
108 |
109 | Ladumor\OneSignal\OneSignalServiceProvider::class,
110 |
111 | ## Add Facade
112 |
113 | Add the Facade to your `config/app.php` into `aliases` section,
114 |
115 | 'OneSignal' => \Ladumor\OneSignal\OneSignal::class,
116 |
117 | ## Add ENV data
118 |
119 | Add your api keys and OneSignal app id to your `.env`,
120 |
121 | ONE_SIGNAL_APP_ID=XXXXXX-XXXXXX-XXXXXX-XXXXXX (YOUR APP ID)
122 | ONE_SIGNAL_AUTHORIZE=XXXXXX (REST API KEY)
123 | ONE_SIGNAL_AUTH_KEY=XXXXXXX (YOUR USER AUTH KEY)
124 |
125 | You can call them into your code with,
126 |
127 | ## Usage
128 |
129 | ### Send Notification
130 |
131 | #### Push
132 |
133 | For send push notification, use the sendPush method by calling, you can refer
134 | this [docs](https://documentation.onesignal.com/reference/create-message) for more fields details.
135 |
136 | $fields['include_aliases']['onesignal_id'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyyyyyy'];
137 | $message = 'hey!! this is test push.!'
138 |
139 | OneSignal::sendPush($fields, $message);
140 |
141 | Optionally, you can obtain the id of the notification like this,
142 |
143 | $notificationID = OneSignal::sendPush($fields, $message);
144 | echo $notificationID["id"];
145 |
146 | #### SMS
147 |
148 | For send SMS notification, use the sendSMS method by calling,
149 |
150 | $fields['include_aliases']['onesignal_id'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyyyyyy'];
151 | OR
152 | $fields['include_phone_numbers'] = ['+15558675310'];
153 |
154 | $fields['sms_from']= "+15558675309";
155 |
156 | $message = 'hey!! this is test SMS.!'
157 |
158 | OneSignal::sendSMS($fields, $message);
159 |
160 | #### EMAIL
161 |
162 | Ensure your Email [setup](https://documentation.onesignal.com/docs/email-setup) is complete.
163 | For send Email notification, use the sendEmail method by calling, see more payload
164 | param [here](https://documentation.onesignal.com/reference/email#schedule-delivery)
165 |
166 | $fields = [
167 | 'email_from_name' => 'Shailesh',
168 | 'email_from_address' => "sml@gmail.com",
169 | 'email_reply_to_address' => "reply@gmail.com",
170 | 'email_subject' => "Welcome to Cat Facts",
171 | 'email_body' => "html>Welcome to Cat Facts