This release simplifies the notification channel naming for better developer experience and alignment with common usage patterns.
The notification channel has been renamed from onesignal to push for simplicity and clarity.
Before (v1.0.0):
public function via($notifiable): array
{
return ['onesignal'];
}
After (v1.1.0):
public function via($notifiable): array
{
return ['push'];
}
Update your notification classes to use the new channel name:
return ['onesignal']; to return ['push'];toPush() method name remains unchangedExample migration:
class WelcomeNotification extends Notification
{
public function via($notifiable): array
{
return ['push']; // Changed from 'onesignal'
}
public function toPush($notifiable): PushMessage // No change here
{
return (new PushMessage())
->withTitle('Welcome!')
->withBody('Thanks for joining')
->toUser($notifiable->id);
}
}
The shorter, simpler push name:
toPush()composer require lepresk/laravel-onesignal:^1.1
Low impact - simple find and replace in your notification classes.
OneSignal push notification package for Laravel applications with clean architecture and comprehensive feature set.
composer require lepresk/laravel-onesignal
Publish the configuration file:
php artisan vendor:publish --tag=onesignal-config
Add credentials to .env:
ONESIGNAL_APP_ID=your-app-id
ONESIGNAL_REST_API_KEY=your-rest-api-key
ONESIGNAL_ANDROID_CHANNEL_ID=your-channel-id
use Lepresk\LaravelOnesignal\Facades\OneSignal;
use Lepresk\LaravelOnesignal\PushMessage;
$message = (new PushMessage())
->withTitle('Hello World')
->withBody('Welcome to our app')
->toExternalUserIds([1, 2, 3]);
$response = OneSignal::send($message);
Full documentation available in the README.
MIT License - see LICENSE file for details.
How can I help you explore Laravel packages today?