cirelramos / external-request
The External Request is a package to send request to others api-rest .
1.0.3
2023-01-03 20:03 UTC
Requires
- php: ^7.4|^8.0
- cirelramos/logs: ^1.0
- guzzlehttp/guzzle: ^6.3.1|^7.0.1
- illuminate/config: ^7.20|^8.19|^9.0
- illuminate/contracts: ^7.20|^8.19|^9.0
- illuminate/database: ^7.20|^8.19|^9.0
- illuminate/http: ^7.20|^8.19|^9.0
README
About
The External Request
is a package to send request to others api-rest .
Tutorial how create composer package
Installation
Require the cirelramos/external-request
package in your composer.json
and update your dependencies:
composer require cirelramos/external-request
Configuration
set provider
'providers' => [ // ... Cirelramos\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="Cirelramos\ExternalRequest\Providers\ServiceProvider"
Note: this is necessary to you can change default config
Usage
use Cirelramos\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.