2017 © Pedro Peláez
 

library zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

image

fnayou/zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

  • Sunday, January 8, 2017
  • by fnayou
  • Repository
  • 1 Watchers
  • 1 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Zeppelin

[Deprecated and Unmaintained], (*1)

Simple Guzzle configurator using client configuration and api descriptions files. 1. All you have to do is to create two files : - the Guzzle client configuration (api url, version, user agent, etc.) - the API description structure 2. use ZeppelinFactory factory or create your own 3. consume APIs, (*2)

Zeppelin aim to let you focus on your main project by providing a simple and easy way to consume api and web services., (*3)

Install

you can install zeppelin using composer, (*4)

``` bash $ composer require fnayou/zeppelin, (*5)


## Usage - create your Guzzle client configuration file based on the [configuration sample file][configuration-sample-link] - create your API description file based on the [api description sample file][api-description-sample-link] - use the `ZeppelinFactory` factory with your favorite `Loader` (more loaders will be released soon) ``` php <?php use Fnayou\Zeppelin\Factory\ZeppelinFactory; use Fnayou\Zeppelin\Loader\YamlLoader; $yamlLoader = YamlLoader(); $configurationFilePath = '/path/to/api_configuration.yml'; $customGuzzleConfiguration = []; $client = ZeppelinFactory::build($yamlLoader, $configurationFilePath, $customGuzzleConfiguration);
  • consume your APIs

``` php <?php, (*6)

// you can access api as method (according to the api description file) try { $response = $client->user([ 'X-APPID' => '26041986', 'user_id' => 26, ]); } catch (\GuzzleHttp\Exception\RequestException $e) { $response = json_decode($e->getResponse()->getBody()->getContents()); }, (*7)

dump($response);, (*8)


- you can also create you own `factory` with your own logic, all you have to do is implement `FactoryInterface` ``` php <?php namespace Vendor\App\Factory; use Fnayou\Zeppelin\ApiClient; use Fnayou\Zeppelin\Api\ApiDescription; use Fnayou\Zeppelin\Factory\FactoryInterface; use Fnayou\Zeppelin\Loader\LoaderInterface; use GuzzleHttp\Client; use GuzzleHttp\Command\Guzzle\GuzzleClient; class CustomFactory implements FactoryInterface { public static function build(LoaderInterface $loader, $filePath, array $config) { // load the guzzle configuration file $apiClientConfiguration = new ApiClient($loader, $filePath); // load the api description file $apiDescription = new ApiDescription( $loader, $apiClientConfiguration->getDescriptionFilePath() ); $client = new Client($apiClientConfiguration->getClientConfiguration()); // your guzzle instance using api description, and custom configuration $zeppelin = new GuzzleClient( $client, $apiDescription->getDescription(), $config ); return $zeppelin; } }

Contributing

Please see CONTRIBUTING and CONDUCT for details., (*9)

Credits

License

The MIT License (MIT). Please see License File for more information., (*10)

The Versions

08/01 2017

dev-master

9999999-dev https://github.com/fnayou/zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

  Sources   Download

MIT

The Requires

 

The Development Requires

api configuration guzzle description web-services

07/09 2016

1.0.3

1.0.3.0 https://github.com/fnayou/zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

  Sources   Download

MIT

The Requires

 

The Development Requires

api configuration guzzle description web-services

07/09 2016

dev-develop

dev-develop https://github.com/fnayou/zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

  Sources   Download

MIT

The Requires

 

The Development Requires

api configuration guzzle description web-services

02/09 2016

1.0.2

1.0.2.0 https://github.com/fnayou/zeppelin

Simple Guzzle configurator using client configuration and api descriptions files.

  Sources   Download

MIT

The Requires

 

The Development Requires

api configuration guzzle description web-services

02/09 2016

1.0.1

1.0.1.0 https://gitlab.com/fnayou/zeppelin

Zeppelin is a simple Guzzle configurator allowing parse and load configuration and api description.

  Sources   Download

MIT

The Requires

 

The Development Requires

configuration guzzle description