Skip to content

Support for Laravel 10 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ Add your OneSignal App ID and REST API Key to your `config/services.php`:
...
'onesignal' => [
'app_id' => env('ONESIGNAL_APP_ID'),
'rest_api_key' => env('ONESIGNAL_REST_API_KEY')
'rest_api_url' => env('ONESIGNAL_REST_API_URL', 'https://api.onesignal.com'),
'rest_api_key' => env('ONESIGNAL_REST_API_KEY'),
'guzzle_client_timeout' => env('ONESIGNAL_GUZZLE_CLIENT_TIMEOUT', 0),
],
...
```
Expand Down
29 changes: 15 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "OneSignal Notifications driver",
"homepage": "https://github.com/laravel-notification-channels/onesignal",
"license": "MIT",
"authors": [{
"authors": [
{
"name": "Marcel Pociot",
"email": "hello@marcelpociot.com",
"homepage": "http://marcelpociot.com"
Expand All @@ -14,26 +15,26 @@
"homepage": "https://spatie.be"
},
{
"name": "Lukas Kämmerling",
"email": "kontakt@lukas-kaemmerling.de",
"homepage": "https://lukas-kaemmerling.de"
"name": "Lukas Kämmerling",
"email": "kontakt@lukas-kaemmerling.de",
"homepage": "https://lukas-kaemmerling.de"
},
{
"name": "David Llop",
"email": "hello@davidllop.com",
"homepage": "http://davidllop.com"
"name": "David Llop",
"email": "hello@davidllop.com",
"homepage": "http://davidllop.com"
}
],
"require": {
"php": "^7.2.0|^8.0",
"berkayk/onesignal-laravel": "^1.0.0",
"illuminate/notifications": "5.*|^6.0|^7.0|^8.0",
"illuminate/support": "5.*|^6.0|^7.0|^8.0"
"php": "^8.0",
"berkayk/onesignal-laravel": "^2.0.0",
"illuminate/notifications": "5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
"illuminate/support": "5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0"
},
"require-dev": {
"mockery/mockery": "^1.3",
"orchestra/testbench": "^4.0|^5.0",
"phpunit/phpunit": "^8.0"
"mockery/mockery": "^1.3|^1.4",
"orchestra/testbench": "^4.0|^5.0|^7.0|^8.0|^9.0|^10.0",
"phpunit/phpunit": "^8.0|^9.5.10|^10.0|^11.5.3"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 4 additions & 7 deletions src/OneSignalButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class OneSignalButton
protected $icon;

/**
* @param string $id
*
* @param string $id
* @return static
*/
public static function create($id)
Expand All @@ -24,7 +23,7 @@ public static function create($id)
}

/**
* @param string $id
* @param string $id
*/
public function __construct($id)
{
Expand All @@ -34,8 +33,7 @@ public function __construct($id)
/**
* Set the message icon.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function icon($value)
Expand All @@ -48,8 +46,7 @@ public function icon($value)
/**
* Set the message subject.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function text($value)
Expand Down
13 changes: 6 additions & 7 deletions src/OneSignalChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ public function __construct(OneSignalClient $oneSignal)
/**
* Send the given notification.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @return \Psr\Http\Message\ResponseInterface
*
* @throws \NotificationChannels\OneSignal\Exceptions\CouldNotSendNotification
*/
public function send($notifiable, Notification $notification)
Expand All @@ -45,10 +45,9 @@ public function send($notifiable, Notification $notification)
}

/**
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param mixed $targeting
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param mixed $targeting
* @return array
*/
protected function payload($notifiable, $notification, $userIds)
Expand Down
32 changes: 12 additions & 20 deletions src/OneSignalMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class OneSignalMessage
protected $payload = [];

/**
* @param string $body
*
* @param string $body
* @return static
*/
public static function create($body = '')
Expand All @@ -29,7 +28,7 @@ public static function create($body = '')
}

/**
* @param string $body
* @param string $body
*/
public function __construct($body = '')
{
Expand All @@ -39,8 +38,7 @@ public function __construct($body = '')
/**
* Set the message body.
*
* @param mixed $value
*
* @param mixed $value
* @return $this
*/
public function setBody($value)
Expand All @@ -51,8 +49,7 @@ public function setBody($value)
/**
* Set the message subject.
*
* @param mixed $value
*
* @param mixed $value
* @return $this
*/
public function setSubject($value)
Expand All @@ -63,8 +60,7 @@ public function setSubject($value)
/**
* Set the message template_id.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function setTemplate($value)
Expand All @@ -75,8 +71,7 @@ public function setTemplate($value)
}

/**
* @param mixed $value
*
* @param mixed $value
* @return array
*/
protected function parseValueToArray($value)
Expand All @@ -87,9 +82,8 @@ protected function parseValueToArray($value)
/**
* Set additional data.
*
* @param string $key
* @param mixed $value
*
* @param string $key
* @param mixed $value
* @return $this
*/
public function setData(string $key, $value)
Expand All @@ -100,9 +94,8 @@ public function setData(string $key, $value)
/**
* Set parameters.
*
* @param string $key
* @param mixed $value
*
* @param string $key
* @param mixed $value
* @return $this
*/
public function setParameter(string $key, $value)
Expand All @@ -115,9 +108,8 @@ public function setParameter(string $key, $value)
/**
* Get parameters.
*
* @param string $key
* @param mixed $default
*
* @param string $key
* @param mixed $default
* @return mixed
*/
public function getParameter(string $key, $default = null)
Expand Down
22 changes: 8 additions & 14 deletions src/OneSignalPayloadFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ class OneSignalPayloadFactory
/**
* Make a one signal notification payload.
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param mixed $targeting
*
* @param mixed $notifiable
* @param \Illuminate\Notifications\Notification $notification
* @param mixed $targeting
* @return array
*/
public static function make($notifiable, Notification $notification, $targeting): array
Expand Down Expand Up @@ -43,8 +42,7 @@ public static function make($notifiable, Notification $notification, $targeting)
}

/**
* @param mixed $targeting
*
* @param mixed $targeting
* @return bool
*/
protected static function isTargetingIncludedSegments($targeting)
Expand All @@ -53,8 +51,7 @@ protected static function isTargetingIncludedSegments($targeting)
}

/**
* @param mixed $targeting
*
* @param mixed $targeting
* @return bool
*/
protected static function isTargetingExternalUserIds($targeting)
Expand All @@ -63,8 +60,7 @@ protected static function isTargetingExternalUserIds($targeting)
}

/**
* @param mixed $targeting
*
* @param mixed $targeting
* @return bool
*/
protected static function isTargetingExcludedSegments($targeting)
Expand All @@ -73,8 +69,7 @@ protected static function isTargetingExcludedSegments($targeting)
}

/**
* @param mixed $targeting
*
* @param mixed $targeting
* @return bool
*/
protected static function isTargetingEmail($targeting)
Expand All @@ -83,8 +78,7 @@ protected static function isTargetingEmail($targeting)
}

/**
* @param mixed $targeting
*
* @param mixed $targeting
* @return bool
*/
protected static function isTargetingTags($targeting)
Expand Down
4 changes: 3 additions & 1 deletion src/OneSignalServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public function boot()
return new OneSignalClient(
$oneSignalConfig['app_id'],
$oneSignalConfig['rest_api_key'],
''
'',
0,
$oneSignalConfig['rest_api_url'] ?? 'https://api.onesignal.com'
);
});
}
Expand Down
14 changes: 5 additions & 9 deletions src/OneSignalWebButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class OneSignalWebButton
protected $url;

/**
* @param string $id
*
* @param string $id
* @return static
*/
public static function create($id)
Expand All @@ -27,7 +26,7 @@ public static function create($id)
}

/**
* @param string $id
* @param string $id
*/
public function __construct($id)
{
Expand All @@ -37,8 +36,7 @@ public function __construct($id)
/**
* Set the message icon.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function icon($value)
Expand All @@ -51,8 +49,7 @@ public function icon($value)
/**
* Set the message subject.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function text($value)
Expand All @@ -65,8 +62,7 @@ public function text($value)
/**
* Set the message url.
*
* @param string $value
*
* @param string $value
* @return $this
*/
public function url($value)
Expand Down
Loading