PHP Classes

Laravel VTU: Buy pre-paid products from VTU providers

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 72 All time: 10,243 This week: 455Up
Version License PHP version Categories
laravel-vtu 1.0.0The PHP License5PHP 5, Wireless and Mobile, E-Commerce
Description 

Author

This package can be used to buy pre-paid products from VTU (Virtual Top Up) providers.

It provide a base VTU class that can be extended to implement the details for buying pre-paid products from different companies that sell them like for instance airtime providers or mobile phone companies that sell data plances.

The applications need to provide a phone number of a customer, the amount to be paid and the provider of the prepaid products, and a callback URL.

The package sends HTTP requests to the Web server of the APIs of the VTU providers to issue a payment to buy credits for delivering a given prepaid product.

The VTU provider will can a given callback function when the product credits are delivered to the customer with the given phone number.

Innovation Award
PHP Programming Innovation award nominee
March 2020
Number 11
VTU (Virtual Top Up) are platforms that can take payment credits to allow customers to buy certain types of products or services later.

This package can integrate with several VTU platforms, so Web sites can take payments for products or services sold via these VTU platforms.

Manuel Lemos
Picture of Zacchaeus Bolaji
  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 17 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 245415 in Nigeria Nigeria
Week rank: 66 Up6 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 12x

Winner: 1x

Documentation

Laravel SMS

CircleCI Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality Code Coverage

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.

Installation

Step 1

You can install the package via composer:

composer require djunehor/laravel-vtu

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Laravel 5.4 and older

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,
];

Lumen

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);
];

Env Keys


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


Step 2 - Publishing files

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

Step 3 - Adding SMS credentials

  • Add the env keys to your `.env` file
  • Or edit the config/laravel-vtu.php file

Usage

//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);

Using Helper function

//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

Available VTU Providers

|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|

Creating custom SMS Provider

  • Create a class that extends `Djunehor\Vtu\Concrete\Vtu` class
  • 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

Contributing

  • Fork this project
  • Clone your forked repo
  • Run `composer install`
  • Make your changes and run tests `composer test`
  • Push and create Pull request

  Files folder image Files (22)  
File Role Description
Files folder image.circleci (1 file)
Files folder image.github (1 directory)
Files folder imagesrc (1 file, 4 directories)
Files folder imagetests (3 files)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (22)  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files (22)  /  .github  
File Role Description
Files folder imageworkflows (1 file)

  Files folder image Files (22)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files (22)  /  src  
File Role Description
Files folder imageConcrete (7 files)
Files folder imageconfig (1 file)
Files folder imageContract (1 file)
Files folder imageHelpers (1 file)
  Plain text file VtuServiceProvider.php Class Class source

  Files folder image Files (22)  /  src  /  Concrete  
File Role Description
  Plain text file CowrieSys.php Class Class source
  Plain text file FpeVtu.php Class Class source
  Plain text file MobileAirtime.php Class Class source
  Plain text file UnikMobileNig.php Class Class source
  Plain text file VoiceAndText.php Class Class source
  Plain text file VTPass.php Class Class source
  Plain text file Vtu.php Class Class source

  Files folder image Files (22)  /  src  /  config  
File Role Description
  Accessible without login Plain text file laravel-vtu.php Conf. Configuration script

  Files folder image Files (22)  /  src  /  Contract  
File Role Description
  Plain text file VtuServiceInterface.php Class Class source

  Files folder image Files (22)  /  src  /  Helpers  
File Role Description
  Accessible without login Plain text file helpers.php Example Example script

  Files folder image Files (22)  /  tests  
File Role Description
  Plain text file TestCase.php Class Class source
  Plain text file VtuHelperTest.php Class Class source
  Plain text file VtuTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:72
This week:0
All time:10,243
This week:455Up