Laravel VTU allows you to buy airtime and data plan, as well as pay for utility bill from your Laravel application using one of over 3 vtu providers, or your own vtu provider.
You can install the package via composer:
composer require djunehor/laravel-vtuThe package will automatically register itself, so you can start using it immediately.
In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:
'providers' => [
// ...
Djunehor\Vtu\VtuServiceProvider::class,
];After installing the package, you will have to register it in bootstrap/app.php file manually:
// Register Service Providers
// ...
$app->register(Djunehor\Vtu\VtuServiceProvider::class);
];VOICE_AND_TEXT_TOKEN
VOICE_AND_TEXT_CALLBACK
COWRIESYS_CLIENT_ID
COWRIESYS_CLIENT_KEY
VTPASS_USERNAME
VTPASS_PASSWORD
FPEVTU_USERNAME
FPEVTU_PASSWORD
UNIK_MOBILE_USERNAME
UNIK_MOBILE_PASSWORD
MOBILE_AIRTIME_USERNAME
MOBILE_AIRTIME_PASSWORD
Run:
php artisan vendor:publish --tag=laravel-vtu
This will move the migration file, seeder file and config file to your app. You can set your sms details in the config file or via env
- Add the env keys to your
.envfile - Or edit the config/laravel-vtu.php file
//using VoiceAndText
use Djunehor\Vtu\Concrete\VoiceAndText;
$vtu = new VoiceAndText();
$amount = 100;
$mobileNumber = '08149659347';
$mobileNetwork = '01';
$callBackUrl = 'http://www.your-website.com';
$send = $vtu->buyAirtime($amount, $mobileNumber, $mobileNetwork, $callBackUrl);//VoiceAndtext
$send = buy_airtime($amount, $mobileNumber, $mobileNetwork, $callBackUrl, $token = 121231112, \Djunehor\Vtu\Concrete\VoiceAndText::class);The default VTU provider is VoiceAndText. You can set the default SMS provider in config/laravel-vtu.php e.g 'default' => \Djunehor\Vtu\Concrete\VoiceAndText::class,, so you can use the helper function like this:
$send = buy_airtime($amount, $mobileNumber, $mobileNetwork);
//$token, $callbackUrl and $class are optional and better set in the config| Provider | URL | Tested |
|---|---|---|
| VoiceAndText | https://www.voiceandtext.com/vtuapi.pdf | Yes |
| CowrieSys | https://github.com/cowriesys/airtime | No |
| FpeVtu | https://fpevtu.com/ | No |
| MobileAirtimeNig | https://mobileairtimeng.com/api | No |
| UnikMobileNig | https://unikmobileng.com/client/api | No |
| VTPass | https://www.vtpass.com/documentation/buying-services/ | No |
- Create a class that extends
Djunehor\Vtu\Concrete\Vtuclass - Implement the required methods (buyAirtime, buyData, PayUtility) which makes the request and return bool
- (Optional) You can add the provider keys to the config/laravel-vtu.php
- Fork this project
- Clone your forked repo
- Run
composer install - Make your changes and run tests
composer test - Push and create Pull request


