2017 © Pedro Peláez
 

library guzzle

A useful base guzzle client.

image

matthewerskine/guzzle

A useful base guzzle client.

  • Wednesday, November 22, 2017
  • by matthew.erskine
  • Repository
  • 1 Watchers
  • 0 Stars
  • 555 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 21 % Grown

The README.md

Guzzle Base Client

This is a simple base Guzzle Client to quickly consume responses from JSON based services., (*1)

Example usage

The respond() will automatically parse out the response from the Guzzle Client so you may quickly interact with it., (*2)


<?php use MatthewErskine\Guzzle\Client; class FruitService extends Client { public function getFruits() { // {"data": [{"title": "banana"}, {"title": "apple"}]} return $this->respond( $this->getHttpClient()->get($this->getUrl().'/bananas') ); } }

Now in a consuming class we can interact with data directly:, (*3)

<?php

class FruitRepository
{
    ...

    public function giveMeABanana()
    {
        foreach ($this->fruitService->getFruits() as $fruit) {
            if ($fruit['title'] == 'banana') {
                return $fruit;
            }
        }
    }
}

The Versions

22/11 2017

dev-master

9999999-dev

A useful base guzzle client.

  Sources   Download

NIT

The Requires

 

by Matthew Erskine

22/11 2017

1.0.0

1.0.0.0

A useful base guzzle client.

  Sources   Download

NIT

The Requires

 

by Matthew Erskine