danialpanah / farapayamak
Laravel Package For Sending Text Messages(SMS) Through Farapayamak API.
Requires
- guzzlehttp/guzzle: ^6.5
Requires (Dev)
- orchestra/testbench: ^3.8
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-10-29 06:05:42 UTC
README
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 inconfig/app.php
in your laravel application:
DanialPanah\Farapayamak\FarapayamakServiceProvider::class
- For using Laravel Facade add the alias to your
aliases[]
array inconfig/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.