Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Onesignal Laravel Package

lepresk/laravel-onesignal

View on GitHub
Deep Wiki
Context7
v1.1.0

Release Notes - v1.1.0

Improved Developer Experience

This release simplifies the notification channel naming for better developer experience and alignment with common usage patterns.

Breaking Changes

Channel Name Change

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'];
}

Migration Guide

Update your notification classes to use the new channel name:

  1. Find all notifications using the OneSignal channel
  2. Change return ['onesignal']; to return ['push'];
  3. The toPush() method name remains unchanged

Example 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);
    }
}

Why This Change?

The shorter, simpler push name:

  • Is more intuitive and easier to remember
  • Aligns with the method name toPush()
  • Reduces verbosity in code
  • Follows common naming patterns

Installation

composer require lepresk/laravel-onesignal:^1.1

Full Changelog

  • Renamed notification channel from 'onesignal' to 'push'
  • Updated documentation and examples
  • Improved dev.to article with detailed OneSignal credential setup guide

Compatibility

  • PHP 8.3 or higher
  • Laravel 11.0 or 12.0
  • All v1.0.0 features remain available

Support

Upgrade Impact

Low impact - simple find and replace in your notification classes.

v1.0.0

Release Notes - v1.0.0

Initial Release

OneSignal push notification package for Laravel applications with clean architecture and comprehensive feature set.

Features

Core Functionality

  • Laravel Notification Channel integration with automatic service discovery
  • Fluent message builder API for iOS, Android, and web push notifications
  • Event system for notification lifecycle tracking (sending, sent, failed)
  • Multiple targeting strategies: external user IDs, segments, and tags
  • Button support with optional URLs for actionable notifications
  • Image attachments and custom data payloads
  • Multi-language content support

Configuration

  • Configurable defaults for TTL, priority, and Android channel ID
  • Published configuration file via artisan command
  • Environment-based configuration without hardcoded values
  • PSR-3 logging integration with configurable channels

Developer Experience

  • Dependency injection pattern throughout codebase
  • Interface-based design for enhanced testability
  • Custom exception hierarchy for granular error handling
  • Facade for convenient static access
  • Comprehensive documentation with usage examples

Quality Assurance

  • Comprehensive test suite: 20 tests with 37 assertions
  • PHPUnit configuration with code coverage support
  • PHPStan Level 8 static analysis with zero errors
  • PSR-12 code style compliance via Laravel Pint
  • GitHub Actions CI/CD workflows for automated testing

Installation

composer require lepresk/laravel-onesignal

Configuration

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

Basic Usage

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);

Requirements

  • PHP 8.3 or higher
  • Laravel 11.0 or 12.0
  • OneSignal account with API credentials

Documentation

Full documentation available in the README.

Support

License

MIT License - see LICENSE file for details.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle