GithubHelp home page GithubHelp logo

yakimka / laravel-notification-channel-turbosms Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 5.0 37 KB

Turbo SMS notification channel for Laravel 5.3+

License: MIT License

PHP 100.00%
turbosms notifications laravel

laravel-notification-channel-turbosms's Introduction

StyleCI Latest Stable Version Total Downloads License

Turbo SMS notifications channel for Laravel 5.3+

Based on github.com/laravel-notification-channels/smsc-ru

This package made for send notifications using turbosms.ua (SOAP) with Laravel 5.3+

Contents

Installation

Firstly you need working soap extension.

You can install the package via composer: composer require yakimka/laravel-notification-channel-turbosms

For Laravel < 5.5 you must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\TurboSms\TurboSmsServiceProvider::class,
],

Setting up the TurboSms service

Add your TurboSms SOAP login, SOAP password and default sender name (or phone number) to your config/services.php:

// config/services.php
...
'turbosms' => [
    'login' => env('TURBOSMS_LOGIN'),
    'secret' => env('TURBOSMS_SECRET'),
    'sender' => 'BRAND',
    'url' => 'http://turbosms.in.ua/api/wsdl.html',
],
...

You need to publish Illuminate\Notifications\NotificationServiceProvider files first.

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\TurboSms\TurboSmsMessage;
use NotificationChannels\TurboSms\TurboSmsChannel;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [TurboSmsChannel::class];
    }

    public function toTurboSms($notifiable)
    {
        return TurboSmsMessage::create("Task #{$notifiable->id} is complete!");
    }
}

In your notifiable model, make sure to include a routeNotificationForTurboSms() method, which return the phone number.

public function routeNotificationForTurboSms()
{
    return $this->phone;
}

or you can send notification in this way:

Notification::route('turbosms', '+380501234567')->notify(new AccountApproved());

or with multiple receivers:

Notification::route('turbosms', '+380501234567,+380631234567')->notify(new AccountApproved());

Available methods

from(): Sets the sender's name or phone number.

content(): Sets a content of the notification message.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

laravel-notification-channel-turbosms's People

Contributors

demeshko avatar kalashs avatar p-andrey avatar yakimka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-notification-channel-turbosms's Issues

Как запускать тесты?

Форкнул, скопировал себе локально гитом репозиторий.
Установил зависимости.

Хочу кое-что доработать и дописать тесты.

Как я могу запустить тесты?
Я дополнительно композером установил phpunit/phpunit
Запускаю команду ./vendor/bin/phpunit

Получаю ошибку PHPUnit_Framework_TestCase

что я делаю не так?

Install on laravel 5.4.*

composer require yakimka/laravel-notification-channel-turbosms:*
Error:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package yakimka/laravel-notification-channel-turbosms * is satisfiable by yakimka/laravel-notification-channel-turbosms[dev-master] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.