Download the PHP package yashcli/onesignal-notifier without Composer

On this page you can find all versions of the php package yashcli/onesignal-notifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package onesignal-notifier

OneSignal Notification Package for Laravel

A comprehensive Laravel package for sending push notifications through OneSignal with support for all features including images, priority, player_id, subscription_id, and more.

Features

Requirements

Installation

1. Install the package

2. Publish the configuration file

3. Configure your OneSignal credentials

Add your OneSignal credentials to your .env file:

Configuration

The configuration file config/onesignal-notifier.php contains all the settings:

Usage

Basic Usage

Using the Facade

Laravel Notifications

Create a notification class:

Creating a Client with Custom Credentials

If you need to send notifications using a different OneSignal App ID and REST API Key (for example, to support multiple OneSignal apps), you can create a client instance with custom credentials:

You can also specify a custom API URL as the third argument if needed.

Recipient Resolution with routeNotificationForOneSignal

You can define a routeNotificationForOneSignal method on your notifiable model (e.g., User) to automatically resolve recipient IDs for notifications. This allows you to avoid specifying player IDs, subscription IDs, or external user IDs in every notification class.

How to use:

Add the method to your notifiable model:

How it works:

Example:

Advanced Features

Images and Icons

Priority and TTL

Platform-Specific Settings

iOS Settings

Android Settings

Huawei Settings

Targeting Options

Subscription IDs (Recommended)

External User IDs

OneSignal IDs

Player IDs (Deprecated)

Buttons and Actions

Scheduling

Filters and Segments

Custom Data

URLs and Deep Linking

Silent Notifications

Error Handling

The package provides comprehensive error handling:

API Reference

Core Methods

Method Description
setContent(array $content) Set notification content for different languages
setHeading(array $heading) Set notification heading for different languages
setSubtitle(array $subtitle) Set notification subtitle for different languages
setName(string $name) Set notification name/template name
setTemplateId(string $templateId) Set template ID
setCustomData(array $data) Set custom data
setData(array $data) Set additional data
setPriority(int $priority) Set notification priority
setTtl(int $ttl) Set TTL (Time To Live) in seconds
setCollapseId(string $collapseId) Set collapse ID for grouping notifications

Targeting Methods

Method Description
setSubscriptionIds(array $ids) Set subscription IDs (recommended)
setExternalUserIds(array $ids) Set external user IDs
setOneSignalIds(array $ids) Set OneSignal IDs
setPlayerIds(array $ids) Set player IDs (deprecated)
setIncludeAliases(array $aliases) Set include aliases

Platform-Specific Methods

Method Description
setIosInterruptionLevel(string $level) Set iOS interruption level
setIosSound(string $sound) Set iOS sound
setIosBadgeType(string $type) Set iOS badge type
setIosBadgeCount(int $count) Set iOS badge count
setAndroidAccentColor(string $color) Set Android accent color
setAndroidChannelId(string $channelId) Set Android channel ID
setHuaweiChannelId(string $channelId) Set Huawei channel ID

Image and Icon Methods

Method Description
setImages(array $images) Set images for different platforms
setIcons(array $icons) Set icons for different platforms
setIosAttachments(array $attachments) Set iOS attachments

Action Methods

Method Description
setButtons(array $buttons) Set buttons for mobile apps
setWebButtons(array $buttons) Set web buttons

Filter and Segment Methods

Method Description
setFilters(array $filters) Set filters for targeting
addFilter(string $field, string $key, string $relation, string $value) Add a filter
setIncludedSegments(array $segments) Set included segments
setExcludedSegments(array $segments) Set excluded segments

Scheduling Methods

Method Description
setScheduling(array $scheduling) Set scheduling options
setSendAfter(string $dateTime) Set send after date/time
setDelayedOption(string $option) Set delayed option
setDeliveryTimeOfDay(string $time) Set delivery time of day

Utility Methods

Method Description
send() Send the notification
getPayload() Get the current payload
reset() Reset the payload to initial state

System Requirements

License

This package is open-sourced software licensed under the MIT license.

Support

For support, please open an issue on GitHub or contact the maintainer.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


All versions of onesignal-notifier with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/notifications Version 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/support Version 5.*|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yashcli/onesignal-notifier contains the following files

Loading the files please wait ...