Skip to content

Yish

Implmenting notification channel

Laravel1 min read

image

Installation Flow

This is private package so you can’t get this.

Navigate to config/services.php adding:

The directory tree

Making the directory, for example, packages/cp/sybase-notification-channel.

Initial composer package settings, the tips are autoload and autoload-dev to load the classes, and automatic discover the service provider. Next, set mainly properties:

composer.json

You need to make provider SybaseChannelServiceProvider and move to cp/sybase-notification-channel changing the namespace to Yish\Notifications.

Local testing

Navigate to up root, set repositories path to load it and convenience development:

If you want to real test(the mean is sending for real), you can create a new laravel project and package directory put inside, and you need to load via repositories path:

Execute composer require cp/sybase-notification-channel and composer dump should be seeing

The mean is discover the service provider.

SybaseChannel Service Provider
Why need construct Guzzle client?

We can mock it easily for testing, by the way config properties too.

Configure phpunit.xml

configure specific test directory

SybaseMessage testing and methods

we need to make message to set subject and content, it’s pretty simple

Implementing

SybaseChannel testing and methods

set up testing

Next, we put in the test case:

And dummy Notifiable and Notification

Implementing SybaseChannel

$notifiable->routeNotificationFor('sybase', $notification) will be check if your class use notifiable trait and implement method routeNotificationForSybase it will be replace property.

See in RoutesNotifications .

Running
Set notification

...or use Notifiable

GitHub - laravel/slack-notification-channel

https://github.com/laravel/nexmo-notification-channel