Giter Site home page Giter Site logo

begimov / smsc-ru Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laravel-notification-channels/smsc-ru

0.0 0.0 0.0 83 KB

smsc.ru notifications channel for Laravel 5.3+

Home Page: http://laravel-notification-channels.com/

License: MIT License

PHP 100.00%

smsc-ru's Introduction

Smsc notifications channel for Laravel 5.3+

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send notifications using smsc.ru (aka СМС–Центр) with Laravel 5.3+.

Contents

Installation

Install this package with Composer:

composer require laravel-notification-channels/smsc-ru

If you're using Laravel 5.x you'll also need to specify a version constraint:

composer require laravel-notification-channels/smsc-ru -v 2.0.3

The service provider gets loaded automatically. Or you can do this manually:

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

Setting up the SmscRu service

Add your SmscRu login, secret key (hashed password) and default sender name (or phone number) to your config/services.php:

// config/services.php
...
'smscru' => [
    'login'  => env('SMSCRU_LOGIN'),
    'secret' => env('SMSCRU_SECRET'),
    'sender' => 'John_Doe',
    'extra'  => [
        // any other API parameters
        // 'tinyurl' => 1
    ],
],
...

If you want use other host than smsc.ru, you MUST set custom host WITH trailing slash.

// .env
...
SMSCRU_HOST=http://www1.smsc.kz/
...
// config/services.php
...
'smscru' => [
    ...
    'host' => env('SMSCRU_HOST'),
    ...
],
...

Usage

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

use Illuminate\Notifications\Notification;
use NotificationChannels\SmscRu\SmscRuMessage;
use NotificationChannels\SmscRu\SmscRuChannel;

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

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

In your notifiable model, make sure to include a routeNotificationForSmscru() method, which returns a phone number or an array of phone numbers.

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

Available methods

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

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

sendAt(): Set a time for scheduling the notification message.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

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.

smsc-ru's People

Contributors

jhaoda avatar freekmurze avatar themsaid avatar vanodevium avatar pinguinjkeke avatar alexey-m-ukolov avatar antonydevanchi avatar artshev avatar casperboone avatar tyurind avatar enniel avatar begimov avatar mhamlet avatar oyed avatar finesse avatar atymic avatar spycrabo avatar

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.