litermi / external-request
The External Request is a package to send request to others api-rest .
1.0.28
2024-12-19 15:47 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: ^6.3.1|^7.0.1
- halaxa/json-machine: dev-master
- illuminate/config: ^7.20|^8.19|^9.0|^10.0|^11.0
- illuminate/contracts: ^7.20|^8.19|^9.0|^10.0|^11.0
- illuminate/database: ^7.20|^8.19|^9.0|^10.0|^11.0
- illuminate/http: ^7.20|^8.19|^9.0|^10.0|^11.0
- litermi/logs: ^1.0
- litermi/simple-notification: ^1.0
README
About
The External Request
is a package to send request to others api-rest .
Tutorial how create composer package
Installation
Require the litermi/external-request
package in your composer.json
and update your dependencies:
composer require litermi/external-request
Configuration
set provider
'providers' => [ // ... Litermi\ExternalRequest\Providers\ServiceProvider::class, ],
The defaults are set in config/external-request.php
. Publish the config to copy the file to your own config:
php artisan vendor:publish --provider="Litermi\ExternalRequest\Providers\ServiceProvider"
Note: this is necessary to you can change default config
Usage
use Litermi\ExternalRequest\ExternalServiceRequestService; $baseUri = "yourdomain.com" $requestPath = "/api/users" $formParams = []; $headers = []; $method = "GET"; $response = ExternalServiceRequestService::execute( $baseUri, $method, $requestPath, $formParams, $header ); $method = "POST"; $formParams = ["username":"cirel", "password":"you"]; $responsePost = ExternalServiceRequestService::execute( $baseUri, $method, $requestPath, $formParams, $headers );
License
Released under the MIT License, see LICENSE.