toriqahmads / sms-viro
A package for use SMS Viro in ease
Requires
- php: ^7.1
Requires (Dev)
- guzzlehttp/guzzle: ^6.0
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2025-04-18 19:04:35 UTC
README
Installation
You can install the package via composer:
composer require toriqahmads/sms-viro
Usage
Create an instance of class, pass apikey and sender name
use Toriqahmads\SmsViro\SmsViro; $smsviro = new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp'); $smsviro->sendSms('089668639048', 'Your otp code is 6989'); var_dump($smsviro->isRequestSuccess());
Framework Integrations
Laravel
1. Direct in controller
Import package in the top of classname
use Toriqahmads\SmsViro\SmsViro;
In method/function, pass apikey and sender name on instance class. call sendSms
to send your message
... $smsviro = new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp'); $smsviro->sendSms('089668639048', 'Your otp code is 6989'); $smsviro->isRequestSuccess(); ...
2. Dependency Injection
Bind class on register method
... use Toriqahmads\SmsViro\SmsViro; class OptimusServiceProvider extends ServiceProvider { public function register() { ... $this->app->singleton(SmsViro::class, function ($app) { return new SmsViro('707474e01fead92a7c9421a4069f21cd-12969e36-b3ef-46d8-8e93-f78804cee22d', 'YourAwesomeApp'); }); } ...
Example controller
... use Toriqahmads\SmsViro\SmsViro; class TestController extends Controller { public function sendSms(SmsViro $smsviro) { $smsviro->sendSms('089668639048', 'Your otp code is 6989'); $smsviro->isRequestSuccess(); } } ...
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email toriq@edu.unisbank.ac.id instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
PHP Package Boilerplate
This package was generated using the PHP Package Boilerplate.