danialpanah/farapayamak

Laravel Package For Sending Text Messages(SMS) Through Farapayamak API.

1.0.1 2020-03-25 16:10 UTC

This package is auto-updated.

Last update: 2024-08-29 05:32:26 UTC


README

Build Status Latest Release on Packagist Software License

Introduction

By using this package you can send SMS Text Messages through Farapayamak RESTful Web Services with your Laravel application.

Installation

  • Use following command to install:
composer require danialpanah/farapayamak

This package supports Laravel auto-discovery feature. If you are using Laravel 5.5 or greater no need to do any further actions, otherwise follow below steps.

  • Add the service provider to your providers[] array in config/app.php in your laravel application:
DanialPanah\Farapayamak\FarapayamakServiceProvider::class
  • For using Laravel Facade add the alias to your aliases[] array in config/app.php in your laravel application:
'Farapayamak': DanialPanah\Farapayamak\Facades\Farapayamak::class

Configuration

  • After installation, you need to add you Farapayamak settings. You can update config/farapayamak.php published file or in you Laravel .env file.

  • Run the following command to publish the configuration file:

php artisan vendor:publish --provider "DanialPanah\Farapayamak\FarapayamakServiceProvider"
  • config/farapayamak.php
return [
    'username' => env('FARAPAYAMAK_USERNAME', ''),
    'password' => env('FARAPAYAMAK_PASSWORD', ''),
    'from' => env('FARAPAYAMAK_FROM', '')
];
  • Add this to .env.example and .env files:
#Farapayamak Credentials and settings
FARAPAYAMAK_USERNAME=
FARAPAYAMAK_PASSWORD=
FARAPAYAMAK_NUMBER=

Usage

Following are some ways which you can have access to farapayamak package:

// Importing the class namespaces before using it
use DanialPanah\Farapayamak\Farapayamak;

$data = [
   'to' => '09121111111',
   'text' => 'Test Message..'
];

$textMessage = new Farapayamak();
$response = $textMessage->send($data);
  • Using Facades:
use DanialPanah\Farapayamak\Facades\Farapayamak;

$response = Farapayamak::send($data);
  • Sending to multiple recipients:
$numbers = ['09121111111', '09132222222', '09153333333'];

$data = [
   'to' => $numbers,
   'text' => 'Multicast Test Message..'
];

$response = Farapayamak::send($data);

Support & Security

This package supports Laravel 5.1 or greater, 6.x and 7.x

  • In case of discovering any issues, please create one on the Issues section.
  • For contribution, fork this repo and implements your code, then create a PR.

License

This repository is an open-source software under the MIT license.