2017 © Pedro Peláez
 

symfony-bundle api-adapter-bundle

Symfony bundle to act as an api connector and adapter for third party apis

image

beyerz/api-adapter-bundle

Symfony bundle to act as an api connector and adapter for third party apis

  • Saturday, June 2, 2018
  • by beyerz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 536 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 29 % Grown

The README.md

Api Adapter Bundle

About

Api Adapter Bundle for Symfony2, (*1)

This bundle provides a gateway and adapter pattern for connecting to thrid party apis., (*2)

Using JMSSerializer, you will simply need to provide the data class to be populated with the api response., (*3)

Installation

composer require beyerz/api-adapter-bundle

Application Kernel

Add BeyerzApiAdapterBundle to the registerBundles() method of your application kernel: Due to the way that this bundle is compiled and the fact that other bundles could require it, please ensure that the bundle is the last parameter in the array., (*4)

public function registerBundles()
{
    return array(
        new Beyerz\ApiAdapterBundle\BeyerzApiAdapterBundle(),
    );
}

Usage

Config

config.yml, (*5)

beyerz_api_adapter:
  json:
    my_client: #name of your client to be used, this will be accessable through container as beyerz_api_adapter.client.YOUR_CUSTOM_NAME
      base_url: "first_base_url"
      options:
        - "an option"
        - "another option"

Files and their purpose

Manager

In the manager you would write any business logic that is related to api, but not directly connected to the api. For example, if you wanted to save a copy of every response that the api returns, you could do this here., (*6)

The manager is essentially the only class that your system should work against in order to interact with the api., (*7)

The manager should have the gateway in the constructor, (*8)

Adapter

The adapters job is to translate the api response into a php class. You select the adapter based on your api response type. For rest apis it is most common to use the JsonAdapter., (*9)

Gateway

We provide base gateway classes, but it is suggested that you extend from one of our base classes and add the api functions that you intend on using., (*10)

Response Entity

A response entity, is a data class that used JMSSeriliazer definitions to translate the API response. This is the class that will be passed to the gateway request from the manager., (*11)

In the event that a class is not passed, the plain Response will be returned to the manager. Sometimes this is useful when building out the api., (*12)

TODO

Add a sample of how it works

The Versions

02/06 2018

dev-master

9999999-dev

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

02/06 2018

1.2.1

1.2.1.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

02/06 2018

1.2.0

1.2.0.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

13/02 2018

1.1.3

1.1.3.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

30/11 2017

dev-develop

dev-develop

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

30/11 2017

1.1.2

1.1.2.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

14/09 2017

1.1.1

1.1.1.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

14/09 2017

1.1.0

1.1.0.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api adapter soap api

13/09 2017

1.0.1

1.0.1.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api client api adapter soap api

13/09 2017

1.0.0

1.0.0.0

Symfony bundle to act as an api connector and adapter for third party apis

  Sources   Download

MIT

The Requires

 

The Development Requires

api rest api symfony2 symfony api client api adapter soap api