📲 SmsOffice.ge service with notification channel for Laravel

Overview

Laravel SmsOffice

Latest Stable Version Total Downloads Downloads Month

This package allows you to send SMS messages with SmsOffice.ge API

You can send sms with notification class or directly with SmsOffice class

Laravel SmsOffice

Table of Contents

Installation

composer require lotuashvili/laravel-smsoffice

For Laravel <= 5.4

If you're using Laravel 5.4 or lower, you have to manually add a service provider in your config/app.php file. Open config/app.php and add SmsOfficeServiceProvider to the providers array.

'providers' => [
    # Other providers
    Lotuashvili\LaravelSmsOffice\SmsOfficeServiceProvider::class,
],

Then run:

php artisan vendor:publish --provider="Lotuashvili\LaravelSmsOffice\SmsOfficeServiceProvider"

Place your api key and sender name in config/smsoffice.php file

Development mode config

If you want to use log in development instead of sending real sms, then add SMSOFFICE_DRIVER=log to your .env file

Usage

Send with notification class

In User class, add routeNotificationForSms() method and return phone number of user

class User extends Authenticatable
{
    # Code...

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

Create notification

php artisan make:notification FooNotification

In our newly created notification, import SmsOfficeChannel and add it to via() method. Write notification content in toSms() method

use Illuminate\Notifications\Notification;
use Lotuashvili\LaravelSmsOffice\SmsOfficeChannel;

class FooNotification extends Notification
{
    public function via($notifiable)
    {
        return [SmsOfficeChannel::class];
    }
    
    public function toSms($notifiable)
    {
        return 'Test Notification';
    }
}

And then send notification to user

$user->notify(new FooNotification)

Send directly without notification

You have to inject or initialize SmsOffice class and then call send function

use Lotuashvili\LaravelSmsOffice\SmsOffice;

public function sendSms(SmsOffice $smsoffice)
{
    $smsoffice->send('599123123', 'Test Message');
}

Get Balance

use Lotuashvili\LaravelSmsOffice\SmsOffice;

public function getBalance(SmsOffice $smsoffice)
{
    $smsoffice->balance();
}
You might also like...
Laravel Lumen service provider for Understand.io

The service provider is deprecated - it does not support error grouping. Laravel Lumen service provider for Understand.io You may also be interested i

Project C2 (Laravel 8.x) - Pemograman Web Service (Semester 5)

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Nusa SMS Laravel Service

A Laravel Service (or library) used to integrate NusaSMS.

Dedicated laravel package for Behpadakht Mellat bank payment service.
Dedicated laravel package for Behpadakht Mellat bank payment service.

Iranian Mellat bank full online payment service Dedicated laravel package for Behpadakht Mellat bank payment service. Features Event calls Log on chan

Service manager for Slim compatible with Laravel packages

SlimServices SlimServices is a service manager for the Slim PHP microframework based on Laravel 4 service providers and DI container, allowing you to

Generate and autoload custom Helpers, Builder Scope, Service class, Trait

laravel-make-extender Generate and autoload custom helpers, It can generate multilevel helpers in the context of the directory. Generate Service class

Adds a service worker to Magento2 to enable PWA features
Adds a service worker to Magento2 to enable PWA features

Monsoon PWA Adds icons, a web manifest file and a service-worker file to make magento 2 a PWA. Main Features Supports Magento Blank and Luma as well a

A simple artisanal command framework for creating service layer classes

Introdução Este projeto tem como objetivo fornecer alguns comandos adicionais à interface de linha de comando do Laravel para manipular a estrutura da

PHP client library for reCAPTCHA, a free service to protect your website from spam and abuse.

reCAPTCHA PHP client library reCAPTCHA is a free CAPTCHA service that protects websites from spam and abuse. This is a PHP library that wraps up the s

Owner
Levan Lotuashvili
Levan Lotuashvili
A laravel service provider for the netsuite-php library service

netsuite-laravel A PHP supplemental package to the ryanwinchester/netsuite-php package to add the NetSuite service client to the service container of

NetsuitePHP 6 Nov 9, 2022
Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).

Laravel-FCM Introduction Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud M

Rahul Thapa 2 Oct 16, 2022
Realtime Notification Module With Laravel & Pusher

About Noftiy Module This module to organize the notification process in real time without need to reload page, using PHP language with Laravel framewo

Mohamed Magdy 1 Jan 9, 2022
🔔 Flasher is a powerful and flexible flash notification system for PHP, Laravel, Symfony

A powerful and flexible flash notifications system for PHP, Laravel, Symfony ?? PHP Flasher helps you to add flash notifications to your PHP projects.

PHP Flasher 158 Jan 4, 2023
A simple Laravel service provider for easily using HTMLPurifier inside Laravel

HTMLPurifier for Laravel 5/6/7/8 A simple Laravel service provider for easily using HTMLPurifier inside Laravel. From their website: HTML Purifier is

MeWebStudio - Muharrem ERÄ°N 1.7k Jan 6, 2023
MediaDB is a web-based media streaming service written in Laravel and Vue.

MediaDB (API) MediaDB is a web-based media streaming service written in Laravel and Vue. The nginx-vod-module is used for on-the-fly repackaging of MP

François M. 53 Sep 3, 2022
A simple package to manage the creation of a structure composed of the service and repository layers in a Laravel application

Chapolim Este projeto tem como objetivo fornecer alguns comandos adicionais à interface de linha de comando do Laravel, o Artisan, para manipular a es

Eliezer Alves 51 Dec 11, 2022
Laravel 4.* and 5.* service providers to handle PHP errors, dump variables, execute PHP code remotely in Google Chrome

Laravel 4.* service provider for PHP Console See https://github.com/barbushin/php-console-laravel/releases/tag/1.2.1 Use "php-console/laravel-service-

Sergey 73 Jun 1, 2022
Load Laravel service providers based on your application's environment.

Laravel EnvProviders A more finetuned way of managing your service providers in Laravel. This package allows you to configure the environment certain

Sven Luijten 79 Dec 29, 2022
Contextual Service Providers for Laravel

Laravel Context This simple yet powerful package will help you load different Service Providers depending in which context you are. Contexts can be se

Rodrigo Troncoso 51 Dec 25, 2020