A laravel package to seamlessly integrate VTU.ng API into your laravel application. The VTU.ng API is an HTTPs GET API that allows you to integrate all virtual top-up and bills payment services available on our platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating our VTU API and resell our services in Nigeria.
# Laravel VTU.ng
## What is VTU.ng
The VTU.ng API is an HTTPs GET API that allows you to integrate all virtual top-up and bills payment services available on our platform with your application (websites, desktop apps & mobile apps). You can also start your own VTU business by integrating our VTU API and resell our services in Nigeria.
## What is Laravel VTU.ng
Laravel VTU.ng is a laravel package to seamlessly integrate VTU.ng api within your laravel application.
Create a VTU.ng Account Sign Up.
Look up VTU.ng API Documentation API Documentation.
## Non-Laravel Usage
If you are using this package in a non-laravel project, or you need a framework agnostic usage of this package, using the vanilla php version php-vtung-vtu is suggested.
## Installation
You can install the package via composer:
```bash
composer require henryejemuta/laravel-vtung
```
Publish VTU.ng configuration file, migrations as well as set default details in .env file:
```bash
php artisan vtung:init
```
## Usage
The Laravel VTU.ng Package is quite easy to use via the VtuDontNG facade
``` php
use HenryEjemuta\LaravelVtuDotNG\Facades\VtuDotNG;
use HenryEjemuta\LaravelVtuDotNG\Classes\VtuDotNGResponse;
...
//To buy Airtime
try{
$response = VtuDotNG::purchaseAirtime('mtn', '1500', '08134567890');
}catch(VtuDotNGErrorException $ex){
Log::error("Error while purchasing airtime\n\r" . $exception->getCode() . ": " . $exception->getMessage());
}
...
```
**Note: To handle upgrade warning differently it is thrown as exception with the message from VTU.ng and an error code of 401**
Find an overview of all method with comment on what they do and expected arguments
``` php
/**
* Get Your wallet available balance, Wallet is identified by username set in vtung config or environmental variable
* @return VtuDotNGResponse
* @throws VtuDotNGErrorException
*/
public function getWalletBalance(): VtuDotNGResponse
/**
* Purchase Airtime with py specifying the network (i.e. mtn, glo, airtel, or 9mobi …