boeki/universal-connector

There is no license information available for the latest version (v1.0.5) of this package.

v1.0.5 2022-04-13 13:02 UTC

This package is auto-updated.

Last update: 2024-11-13 18:54:40 UTC


README

UniversalConnector is a native PHP library allowing the instantiation of a multitude of common APIs on the market. The library is updated regularly with the contribution of new instances and new methods within the API.

Versions

Requirements

  • php >=5.3.0

Installation

# composer
composer require boeki/universal-connector

Usage

Instantiating the desired API class

# Magento
$api = APIProvider::Magento2Instance();

# SendinBlue
$api = APIProvider::SendinBlueInstance();

Initialization of the connection pipe

# Magento
$api->initialize("username", "password", "http://example.com");

# SendinBlue
$api->initialize("xkeysib-5bbxxxxxxxxxxxxxxxx");

Optional: you can provide a default website ID for the next request for Magento2

# Magento
$api->setWebsite($website_id);

Request examples

# SendinBlue
use UniversalConnector\API\APIProvider;
use UniversalConnector\API\SendinBlue\Builder\SendinBlueTools;

$api = APIProvider::SendinBleuInstance();
$api->initialize("xkeysib-5bbxxxxxxxxxxxxxxxx");

$fileBody = SendinBlueTools::CONTACTS_FILE_BODY(
	["EMAIL","NOM","PRENOM","SMS"],
	[
		["james@example.com","Standbridge","James","972542116060"],
		["Vanessa@example.com","Lucas","Vanessa","972542116061"],
		["Arthur@example.com","Arnold","Arthur","972542116063"]
	]
);


$response = $api->POST_contacts(
	$fileBody, 
	null, 
	["listName" => "Universal-connector_list_test", "folderId" => 9],
	true, 
	false, 
	null, 
	false, 
	false
);

Magento2 methods

SendinBlue methods