realconnex / http-request
Realconnex request library.
Installs: 393
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/realconnex/http-request
Requires
- php: >=7.2.7
- ext-json: *
- guzzlehttp/guzzle: >=6
Requires (Dev)
- phpunit/phpunit: 6
- symfony/http-foundation: ^4.1.2
This package is not auto-updated.
Last update: 2025-10-23 22:18:03 UTC
README
Common library to make request
Installation
$ composer require realconnex/http-request
Configuration
Register class as a service in service.yml
parameters: # flag indicates verification of hosts certificates verifyHost: '%env(bool:VERIFY_HOST)%' # web services names configuration webServices: green: '%env(string:SERVICE_DOMAIN_GREEN)%' blue: '%env(string:SERVICE_DOMAIN_BLUE)%' mc: '%env(string:SERVICE_DOMAIN_MC)%' feed: '%env(string:SERVICE_DOMAIN_FEED)%' mbau: '%env(string:SERVICE_DOMAIN_MBA)%' search: '%env(string:SERVICE_DOMAIN_SEARCH)%' email: '%env(string:SERVICE_DOMAIN_EMAIL)%' fapi: '%env(string:SERVICE_DOMAIN_FAPI)%' file: '%env(string:SERVICE_DOMAIN_FILE)%' services: Realconnex\HttpRequest: arguments: $webServices: '%webServices%' $verifyHost: '%verifyHost%' public: true
Usage
Inject package into you class
public function __construct(HttpRequest $httpRequest) { $this->httpRequest = $httpRequest; }
Send request
$response = $this->httpRequest->sendRequest( HttpServices::MC, // service you want to reach 'api/v1/notifications', // uri HttpRequest::METHOD_POST, // method $payload // payload );
Options
verifyHost– flag allows to set Guzzle client “verify” option for SSL-certificates verification.webServices– specifies a list of web services in format “name:domain” which this service can work with.processExceptions– flag indicates if exceptions should be processed automatically.parseJson– flag specifies that response should be automatically parsed as JSON.authToken– JWT token string for header Authorization.provideAuth– flag allows to specify should service use Authorization header or not (could be used in chain of microservices).