From 23c1e44284e847a8d58c6bd1d0f43fa305b46017 Mon Sep 17 00:00:00 2001 From: atymic Date: Fri, 13 Sep 2019 08:37:22 +1000 Subject: [PATCH] chore: support newer laravel - bump min PHP to 7.0 - bump min laravel to 5.5 - support 5.5+ & 6.0 - bump pusher-php-server and allow 3.x or 4.x - fix breaking change (namespaces) - update readme --- .styleci.yml | 2 -- .travis.yml | 5 ++--- README.md | 4 ++-- composer.json | 14 +++++++------- src/PusherChannel.php | 8 ++++---- src/PusherPushNotificationsServiceProvider.php | 2 +- tests/ChannelTest.php | 10 +++++----- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.styleci.yml b/.styleci.yml index 916d27e..0285f17 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -1,3 +1 @@ preset: laravel - -linting: true diff --git a/.travis.yml b/.travis.yml index ff42c2c..16142e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: php php: - - 5.6 - - 7.0 - - 7.1 + - 7.2 + - 7.3 env: matrix: diff --git a/README.md b/README.md index 5a22763..be12762 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pusher push notifications channel for Laravel 5.3 +# Pusher push notifications channel for Laravel 5.5+ & 6.0 [![Latest Version on Packagist](https://img.shields.io/packagist/v/laravel-notification-channels/pusher-push-notifications.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/pusher-push-notifications) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) @@ -9,7 +9,7 @@ [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/laravel-notification-channels/pusher-push-notifications/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/laravel-notification-channels/pusher-push-notifications/?branch=master) [![Total Downloads](https://img.shields.io/packagist/dt/laravel-notification-channels/pusher-push-notifications.svg?style=flat-square)](https://packagist.org/packages/laravel-notification-channels/pusher-push-notifications) -This package makes it easy to send [Pusher push notifications](https://pusher.com/docs/push_notifications) with Laravel 5.3. +This package makes it easy to send [Pusher push notifications](https://pusher.com/docs/push_notifications) with Laravel. ## Contents diff --git a/composer.json b/composer.json index ebfc3a1..b6fdf38 100644 --- a/composer.json +++ b/composer.json @@ -32,16 +32,16 @@ } ], "require": { - "php": ">=5.6.4", - "illuminate/events": "5.3.* || 5.4.* || 5.5.* || 5.6.*", - "illuminate/notifications": "5.3.* || 5.4.* || 5.5.* || 5.6.*", - "illuminate/queue": "5.3.* || 5.4.* || 5.5.* || 5.6.*", - "illuminate/support": "5.3.* || 5.4.* || 5.5.* || 5.6.*", - "pusher/pusher-php-server": "2.6.*" + "php": ">=7.0", + "illuminate/events": "~5.5 || ~6.0", + "illuminate/notifications": "~5.5 || ~6.0", + "illuminate/queue": "~5.5 || ~6.0", + "illuminate/support": "~5.5 || ~6.0", + "pusher/pusher-php-server": "~3.0 || ~4.0" }, "require-dev": { "mockery/mockery": "^0.9.5", - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "5.*" }, "autoload": { "psr-4": { diff --git a/src/PusherChannel.php b/src/PusherChannel.php index 6772232..4498d7b 100644 --- a/src/PusherChannel.php +++ b/src/PusherChannel.php @@ -2,7 +2,7 @@ namespace NotificationChannels\PusherPushNotifications; -use Pusher; +use Pusher\Pusher; use Illuminate\Events\Dispatcher; use Illuminate\Notifications\Notification; use Illuminate\Notifications\Events\NotificationFailed; @@ -10,7 +10,7 @@ class PusherChannel { /** - * @var \Pusher + * @var Pusher */ protected $pusher; @@ -20,7 +20,7 @@ class PusherChannel private $events; /** - * @param \Pusher $pusher + * @param Pusher $pusher */ public function __construct(Pusher $pusher, Dispatcher $events) { @@ -42,7 +42,7 @@ public function send($notifiable, Notification $notification) ?: $this->interestName($notifiable); $response = $this->pusher->notify( - $interest, + is_array($interest) ? $interest : [$interest], $notification->toPushNotification($notifiable)->toArray(), true ); diff --git a/src/PusherPushNotificationsServiceProvider.php b/src/PusherPushNotificationsServiceProvider.php index c67f170..195c43c 100644 --- a/src/PusherPushNotificationsServiceProvider.php +++ b/src/PusherPushNotificationsServiceProvider.php @@ -2,8 +2,8 @@ namespace NotificationChannels\PusherPushNotifications; +use Pusher\Pusher; use Illuminate\Support\ServiceProvider; -use Pusher; class PusherPushNotificationsServiceProvider extends ServiceProvider { diff --git a/tests/ChannelTest.php b/tests/ChannelTest.php index 1402863..8436355 100644 --- a/tests/ChannelTest.php +++ b/tests/ChannelTest.php @@ -2,15 +2,15 @@ namespace NotificationChannels\PusherPushNotifications\Test; +use Mockery; +use Pusher\Pusher; +use PHPUnit_Framework_TestCase; use Illuminate\Events\Dispatcher; -use Illuminate\Notifications\Events\NotificationFailed; use Illuminate\Notifications\Notifiable; -use NotificationChannels\PusherPushNotifications\PusherChannel; use Illuminate\Notifications\Notification; +use Illuminate\Notifications\Events\NotificationFailed; +use NotificationChannels\PusherPushNotifications\PusherChannel; use NotificationChannels\PusherPushNotifications\PusherMessage; -use PHPUnit_Framework_TestCase; -use Mockery; -use Pusher; class ChannelTest extends PHPUnit_Framework_TestCase {