Introducing Laravel Nubapi Client: Your Key to Seamless API Integration
<?php +use Donejeh\Nuban\Nubapi; use Illuminate\Support\Facades\Route;
/* |-------------------------------------------------------------------------- | Web Routes |-------------------------------------------------------------------------- | | Here is where you can register web routes for your application. These | routes are loaded by the RouteServiceProvider within a group which | contains the "web" middleware group. Now create something great! | */ Route::get('/', function () { return view('welcome'); }); Route::get('/dashboard', function () { return view('dashboard'); })->middleware(['auth', 'verified'])->name('dashboard'); + +Route::get('/verify', function () {+ + return app(Nubapi::class)+ ->getAccountDetails('7038804001', '999992');+ +}); require __DIR__.'/auth.php';
In the ever-evolving landscape of web development, efficiency is key. Developers continually seek tools and packages that streamline their workflows, and today, we're thrilled to introduce the Laravel Nubapi Client – a package by Donejeh.
Simplified Installation
Kickstart your journey with the Laravel Nubapi Client with just a few simple steps. Begin by requiring the package via Composer:
composer require donejeh/nuban
Once the package is successfully integrated, it's time to configure it for your Laravel application. This process is straightforward; simply add the NubapiServiceProvider
to your Application Service Providers:
Donejeh\Nuban\NubapiServiceProvider::class
Configuration Made Easy
Customizing your API integration experience has never been more straightforward. After incorporating the ServiceProvider, you'll need to publish the configuration file by executing the following command:
php artisan vendor:publish --provider="Donejeh\Nuban\NubapiServiceProvider" --tag="config"
This action generates a nubapi.php
file within your config
directory, providing you with full control over your API settings. Here's a glimpse of the sample configuration:
return [ 'host' => env('NUB_API_HOST', 'https://nubapi.com/api'), 'api_token' => env('NUB_API_TOKEN', ''), 'options' => [ 'validate_number_locally' => true, 'request_timeout' => 5, ]];
Your Gateway to the API
Your API token, graciously offered by Nubapi.com, serves as your passport to seamless API access. Whether your project is personal, commercial, or open-source, these tokens are freely available to suit your needs.
Unleash the API Power
With your API token at hand and the Laravel Nubapi Client expertly configured, you're ready to harness the full potential of the Nubapi API. In your Laravel application controller, insert the following code snippet to effortlessly retrieve account details:
use Donejeh\Nuban\Nubapi; $nubanApi = app(NubanApi::class);$response = $nubanApi->getAccountDetails('1056684123', '013'); print_r($response);
This code simplifies the process of retrieving account details, allowing you to focus on what truly matters – your application's logic and functionality.
In conclusion, the Laravel Nubapi Client is a valuable asset for developers aiming to seamlessly integrate APIs into their Laravel projects. With its painless installation, configuration flexibility, and robust API capabilities, it's a must-have tool within the Laravel community. Don't miss the chance to simplify your API integration tasks – give it a try today!
No comments yet…
Please login or create an account to participate in this conversation.