dasun4u / laravel-ideabiz-handler
Laravel package for IDEABIZ REST API handling
2.0.1
2022-04-24 18:21 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: 7.4.2
This package is auto-updated.
Last update: 2025-03-25 00:45:37 UTC
README
Laravel IDEABIZ Handler (Laravel 8.0+)
Laravel IDEABIZ Handler is a laravel plugin to handle REST API request for IDEABIZ APIs
Requirements
- PHP 7.0+
- Laravel 8.0+
Installation
- Install the package by running this command in your terminal/cmd:
composer require dasun4u/laravel-ideabiz-handler
- You can import config file and sample token file by running this command in your terminal/cmd:
php artisan vendor:publish --provider="Dasun4u\LaravelIDEABIZHandler\RestAPIProvider"
-
Then set the configurations in ideabiz.php file.
-
For the first time, token generate using 'grant_type' => 'password' or manualy. Verify that token.json file has the valid access token and refresh token
It has following functions:
- Generate access token
IDEABIZ::generateAccessToken();
- Get access token
IDEABIZ::getAccessToken();
- Make the request
$access_token = IDEABIZ::getAccessToken(); $url = "https://ideabiz.lk/apicall/xyz" $method = "POST"; $headers = [ "Content-Type" => "application/json", "Authorization" => "Bearer ".$access_token, "Accept" => "application/json", ]; $request_body = [ "a" => 123, "b" => "xyz", ]; // Rest API request and response get to a variable $response = IDEABIZ::apiCall($url, $method, $headers, $request_body); // Get response body $response->getBody(); // Get status code $response->getStatusCode(); // Get response headers $response->getHeaders();
Author
License
This project is licensed under the MIT License - see the LICENSE file for details
Special Thanks to
- Laravel Community