adelowo/laravel-gbowo is a Laravel package for laravel bridge for the gbowo payment library.
It currently has 1 GitHub stars and 26 downloads on Packagist (latest version 1.0.0).
Install it with composer require adelowo/laravel-gbowo.
Discover more Laravel packages by adelowo
or browse all Laravel packages to compare alternatives.
Last updated
$ composer require adelowo/laravel-gbowo
GbowoServiceProvider to the provider key in config/app.phpGbowo\Bridge\Laravel\GbowoServiceProvider::class
config/services.php<?php
//...other config values
"gbowo" => [
"default" => "paystack"
];
This step is optionally but can be helpful when you are certain you wouldn't be switching adapters in multiple places in your app.
Only paystack and amplifypay are currently supported.
aliases key in config/app.php
"Gbowo" : Gbowo\Bridge\Laravel\Facades::class
Gbowo's official doc is highly recommendeded.
class BillingController extends Controller
{
public function chargeCustomer(Request $request)
{
$adapter = app("gbowo")->adapter("paystack");
// $adapter = app("gbowo")->adapter("amplifypay");
$data = ["email" => $request->get('email') , "amount" => $request->get('amount')];
return redirect($adapter->charge($data));
}
}
Calling the
adaptermethod without passing in an adapter name would return an instance of the default adapter set in the config file.
If you have written a custom adapter, you can include this in your app by doing what is obtainable below in a ServiceProvider of your choice.
$config = ["key" => "value", "other" => "stuff"]; //some bootstrap options your adapter might need.
$this->app["gbowo"]->extend("voguepay" , function() use ($config)){
return new VoguePayAdapter($config);
});
And you can access this new adapter anywhere in your code via
$voguePay = app("gbowo")->adapter("voguePay");
$voguePay->charge(['c' => 'd']);
use Gbowo\Bridge\Laravel\Facades
Gbowo::adapter("paystack")->charge([])
//You can call any method on the facade as you would in the normal instance. Do check the api methods
createPaystackAdapter()createAmplifyPayAdapter()extend(string $adapterName, Closure $callback)adapter(string $name = null)If
$nameis left null, the default adapter would be fetched by inspecting the value ofconfig.services.gbowo.default