Mocean Notification Channel for laravel.

1.0.1 2019-09-26 07:14 UTC


Latest Stable Version Build Status StyleCI License Total Downloads


To install the library, run this command in terminal:

composer require mocean/laravel-notification-channel

Laravel 5.5

You don't have to do anything else, this package autoloads the Service Provider and create the Alias, using the new Auto-Discovery feature.

Laravel 5.4 and below

Add the Service Provider and Facade alias to your config/app.php

'providers' => [


You must publish the config file as this will use Laravel Mocean as a package.

php artisan vendor:publish --provider="Mocean\Laravel\MoceanServiceProvider"

Create a notification class, refer laravel official docs

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;

class InvoicePaid extends Notification
    use Queueable;
    public function via($notifiable)
        //define mocean-sms as notification channel
        return ['mocean-sms'];
    public function toMoceanSms($notifiable)
        //return the text message u want to send here
        return 'You have received an invoice';
        //you can also return an array for custom options, refer moceanapi docs
        return [
            'mocean-text' => 'You have received an invoice',
            'mocean-dlr-url' => ''

to specify which attribute should be used to be a notifiable entity, create method routeNotificationForMoceanSms

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
    use Notifiable;
    public function routeNotificationForMoceanSms($notification)
        //make sure user model has this attribute, else the notification will not be sent
        return $this->phone;

send the notification to a user

$user->notify(new InvoicePaid());

you can also send the notification to a custom phone number without using user model

use Notification;

Notification:route('mocean-sms', '60123456789')
    ->notify(new InvoicePaid());


Mocean Laravel Notification is licensed under the MIT License