thomxc/guzzleplug

Guzzle Bootstrap class for easy

Installs: 2 116

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

pkg:composer/thomxc/guzzleplug

0.2 2021-06-01 15:15 UTC

This package is auto-updated.

Last update: 2025-12-20 02:28:48 UTC


README

Example

<?php

class Service extends GuzzlePlug\GuzzlePlug
{
    public function __construct($url = 'https://api.myservice.com')
    {
        $this->url = $url;
    }
    
    public function getRequest()
    {
        $response = $this->request('GET', $this->url);
        if ($this->actualResponse->getStatusCode() == 200) {
            return $response;
        } else {
            throw new Exception('Response status code != 200');
        }
    }
}